memblock tests: add new pageblock related macro
authorKefeng Wang <wangkefeng.wang@huawei.com>
Wed, 7 Sep 2022 08:26:43 +0000 (16:26 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:04 +0000 (14:03 -0700)
Add new pageblock_start_pfn() and pageblock_align() macro which are needed
by memblock tests.

Link: https://lkml.kernel.org/r/20220907082643.186979-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/memblock/linux/mmzone.h

index 7c2eb5c..e65f89b 100644 (file)
@@ -22,6 +22,8 @@ enum zone_type {
 
 #define pageblock_order                (MAX_ORDER - 1)
 #define pageblock_nr_pages     BIT(pageblock_order)
+#define pageblock_align(pfn)   ALIGN((pfn), pageblock_nr_pages)
+#define pageblock_start_pfn(pfn)       ALIGN_DOWN((pfn), pageblock_nr_pages)
 
 struct zone {
        atomic_long_t           managed_pages;