mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
mm/page_alloc: remove ifdefs from pindex helpers
The ifdefs are not technically needed here, everything used here is always defined. Switching to IS_ENABLED() makes the code a bit less tiresome to read. Link: https://lore.kernel.org/20260513-page_alloc-unmapped-prep-v1-4-dacdf5402be8@google.com Signed-off-by: Brendan Jackman <jackmanb@google.com> Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: Barry Song <baohua@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kairui Song <kasong@tencent.com> Cc: Len Brown <lenb@kernel.org> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Wei Xu <weixugc@google.com> Cc: Yuanchu Xie <yuanchu@google.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
3687c0fd67
commit
248b144a8a
|
|
@ -650,19 +650,17 @@ static void bad_page(struct page *page, const char *reason)
|
|||
|
||||
static inline unsigned int order_to_pindex(int migratetype, int order)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
|
||||
bool movable = migratetype == MIGRATE_MOVABLE;
|
||||
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
bool movable;
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER) {
|
||||
VM_BUG_ON(!is_pmd_order(order));
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER) {
|
||||
VM_BUG_ON(!is_pmd_order(order));
|
||||
|
||||
movable = migratetype == MIGRATE_MOVABLE;
|
||||
|
||||
return NR_LOWORDER_PCP_LISTS + movable;
|
||||
return NR_LOWORDER_PCP_LISTS + movable;
|
||||
}
|
||||
} else {
|
||||
VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
|
||||
}
|
||||
#else
|
||||
VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
|
||||
#endif
|
||||
|
||||
return (MIGRATE_PCPTYPES * order) + migratetype;
|
||||
}
|
||||
|
|
@ -671,12 +669,12 @@ static inline int pindex_to_order(unsigned int pindex)
|
|||
{
|
||||
int order = pindex / MIGRATE_PCPTYPES;
|
||||
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
if (pindex >= NR_LOWORDER_PCP_LISTS)
|
||||
order = HPAGE_PMD_ORDER;
|
||||
#else
|
||||
VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
|
||||
if (pindex >= NR_LOWORDER_PCP_LISTS)
|
||||
order = HPAGE_PMD_ORDER;
|
||||
} else {
|
||||
VM_BUG_ON(order > PAGE_ALLOC_COSTLY_ORDER);
|
||||
}
|
||||
|
||||
return order;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user