mm, treewide: redefine MAX_ORDER sanely
MAX_ORDER currently defined as number of orders page allocator supports: user can ask buddy allocator for page order between 0 and MAX_ORDER-1. This definition is counter-intuitive and lead to number of bugs all over the kernel. Change the definition of MAX_ORDER to be inclusive: the range of orders user can ask from buddy allocator is 0..MAX_ORDER now. [kirill@shutemov.name: fix min() warning] Link: https://lkml.kernel.org/r/20230315153800.32wib3n5rickolvh@box [akpm@linux-foundation.org: fix another min_t warning] [kirill@shutemov.name: fixups per Zi Yan] Link: https://lkml.kernel.org/r/20230316232144.b7ic4cif4kjiabws@box.shutemov.name [akpm@linux-foundation.org: fix underlining in docs] Link: https://lore.kernel.org/oe-kbuild-all/202303191025.VRCTk6mP-lkp@intel.com/ Link: https://lkml.kernel.org/r/20230315113133.11326-11-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> [powerpc] Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
61883d3c32
commit
23baf831a3
@@ -17,10 +17,10 @@ enum zone_type {
|
||||
};
|
||||
|
||||
#define MAX_NR_ZONES __MAX_NR_ZONES
|
||||
#define MAX_ORDER 11
|
||||
#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
|
||||
#define MAX_ORDER 10
|
||||
#define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
|
||||
|
||||
#define pageblock_order (MAX_ORDER - 1)
|
||||
#define pageblock_order MAX_ORDER
|
||||
#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)
|
||||
|
||||
Reference in New Issue
Block a user