+ mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/pageblock: throw compile error if pageblock_bits cannot hold MIGRATE_TYPES
has been added to the -mm tree.  Its filename is
     mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Pingfan Liu <kernelfans@xxxxxxxxx>
Subject: mm/pageblock: throw compile error if pageblock_bits cannot hold MIGRATE_TYPES

Currently, NR_PAGEBLOCK_BITS and MIGRATE_TYPES are not associated by code.
If someone adds extra migrate type, then he may forget to enlarge the
NR_PAGEBLOCK_BITS.  Hence it requires some way to fix.

NR_PAGEBLOCK_BITS depends on MIGRATE_TYPES, while these macro spread on
two different .h file with reverse dependency, it is a little hard to
refer to MIGRATE_TYPES in pageblock-flag.h.  This patch tries to remind
such relation in compiling-time.

Link: http://lkml.kernel.org/r/1544508709-11358-1-git-send-email-kernelfans@xxxxxxxxx
Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Pavel Tatashin <pavel.tatashin@xxxxxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>
Cc: Oscar Salvador <osalvador@xxxxxxx>
Cc: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx>
Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Cc: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/pageblock-flags.h |    3 ++-
 mm/page_alloc.c                 |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

--- a/include/linux/pageblock-flags.h~mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types
+++ a/include/linux/pageblock-flags.h
@@ -25,10 +25,11 @@
 
 #include <linux/types.h>
 
+#define PB_migratetype_bits 3
 /* Bit indices that affect a whole block of pages */
 enum pageblock_bits {
 	PB_migrate,
-	PB_migrate_end = PB_migrate + 3 - 1,
+	PB_migrate_end = PB_migrate + PB_migratetype_bits - 1,
 			/* 3 bits required for migrate types */
 	PB_migrate_skip,/* If set the block is skipped by compaction */
 
--- a/mm/page_alloc.c~mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types
+++ a/mm/page_alloc.c
@@ -428,6 +428,7 @@ void set_pfnblock_flags_mask(struct page
 	unsigned long old_word, word;
 
 	BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4);
+	BUILD_BUG_ON(MIGRATE_TYPES > (1 << PB_migratetype_bits));
 
 	bitmap = get_pageblock_bitmap(page, pfn);
 	bitidx = pfn_to_bitidx(page, pfn);
_

Patches currently in -mm which might be from kernelfans@xxxxxxxxx are

mm-pageblock-throw-compiling-time-error-if-pageblock_bits-can-not-hold-migrate_types.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux