mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
23baf831a3
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>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright(c) 2018 Intel Corporation. All rights reserved.
|
|
#ifndef _MM_SHUFFLE_H
|
|
#define _MM_SHUFFLE_H
|
|
#include <linux/jump_label.h>
|
|
|
|
#define SHUFFLE_ORDER MAX_ORDER
|
|
|
|
#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
|
|
DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
|
|
extern void __shuffle_free_memory(pg_data_t *pgdat);
|
|
extern bool shuffle_pick_tail(void);
|
|
static inline void __meminit shuffle_free_memory(pg_data_t *pgdat)
|
|
{
|
|
if (!static_branch_unlikely(&page_alloc_shuffle_key))
|
|
return;
|
|
__shuffle_free_memory(pgdat);
|
|
}
|
|
|
|
extern void __shuffle_zone(struct zone *z);
|
|
static inline void __meminit shuffle_zone(struct zone *z)
|
|
{
|
|
if (!static_branch_unlikely(&page_alloc_shuffle_key))
|
|
return;
|
|
__shuffle_zone(z);
|
|
}
|
|
|
|
static inline bool is_shuffle_order(int order)
|
|
{
|
|
if (!static_branch_unlikely(&page_alloc_shuffle_key))
|
|
return false;
|
|
return order >= SHUFFLE_ORDER;
|
|
}
|
|
#else
|
|
static inline bool shuffle_pick_tail(void)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
static inline void shuffle_free_memory(pg_data_t *pgdat)
|
|
{
|
|
}
|
|
|
|
static inline void shuffle_zone(struct zone *z)
|
|
{
|
|
}
|
|
|
|
static inline bool is_shuffle_order(int order)
|
|
{
|
|
return false;
|
|
}
|
|
#endif
|
|
#endif /* _MM_SHUFFLE_H */
|