mirror of
https://github.com/torvalds/linux.git
synced 2026-12-02 19:42:26 +00:00
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. [[email protected]: fix min() warning] Link: https://lkml.kernel.org/r/20230315153800.32wib3n5rickolvh@box [[email protected]: fix another min_t warning] [[email protected]: fixups per Zi Yan] Link: https://lkml.kernel.org/r/[email protected] [[email protected]: fix underlining in docs] Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kirill A. Shutemov <[email protected]> Reviewed-by: Michael Ellerman <[email protected]> [powerpc] Cc: "Kirill A. Shutemov" <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
38 lines
863 B
C
38 lines
863 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _TOOLS_MMZONE_H
|
|
#define _TOOLS_MMZONE_H
|
|
|
|
#include <linux/atomic.h>
|
|
|
|
struct pglist_data *first_online_pgdat(void);
|
|
struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
|
|
|
|
#define for_each_online_pgdat(pgdat) \
|
|
for (pgdat = first_online_pgdat(); \
|
|
pgdat; \
|
|
pgdat = next_online_pgdat(pgdat))
|
|
|
|
enum zone_type {
|
|
__MAX_NR_ZONES
|
|
};
|
|
|
|
#define MAX_NR_ZONES __MAX_NR_ZONES
|
|
#define MAX_ORDER 10
|
|
#define MAX_ORDER_NR_PAGES (1 << MAX_ORDER)
|
|
|
|
#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)
|
|
|
|
struct zone {
|
|
atomic_long_t managed_pages;
|
|
};
|
|
|
|
typedef struct pglist_data {
|
|
struct zone node_zones[MAX_NR_ZONES];
|
|
|
|
} pg_data_t;
|
|
|
|
#endif
|