Skip to content

Commit

Permalink
mm/page_alloc: invert logic for early page initialisation checks
Browse files Browse the repository at this point in the history
Rename early_page_uninitialised() to early_page_initialised() and invert
its logic to make the code more readable.

Link: https://lkml.kernel.org/r/20230104191805.2535864-1-rppt@kernel.org
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Mike Rapoport (IBM) authored and Andrew Morton committed Jan 19, 2023
1 parent f78dfc7 commit fc57448
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ static inline bool deferred_pages_enabled(void)
return static_branch_unlikely(&deferred_pages);
}

/* Returns true if the struct page for the pfn is uninitialised */
static inline bool __meminit early_page_uninitialised(unsigned long pfn)
/* Returns true if the struct page for the pfn is initialised */
static inline bool __meminit early_page_initialised(unsigned long pfn)
{
int nid = early_pfn_to_nid(pfn);

if (node_online(nid) && pfn >= NODE_DATA(nid)->first_deferred_pfn)
return true;
return false;

return false;
return true;
}

/*
Expand Down Expand Up @@ -498,9 +498,9 @@ static inline bool deferred_pages_enabled(void)
return false;
}

static inline bool early_page_uninitialised(unsigned long pfn)
static inline bool early_page_initialised(unsigned long pfn)
{
return false;
return true;
}

static inline bool defer_init(int nid, unsigned long pfn, unsigned long end_pfn)
Expand Down Expand Up @@ -1643,7 +1643,7 @@ static void __meminit init_reserved_page(unsigned long pfn)
pg_data_t *pgdat;
int nid, zid;

if (!early_page_uninitialised(pfn))
if (early_page_initialised(pfn))
return;

nid = early_pfn_to_nid(pfn);
Expand Down Expand Up @@ -1806,7 +1806,7 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
void __init memblock_free_pages(struct page *page, unsigned long pfn,
unsigned int order)
{
if (early_page_uninitialised(pfn))
if (!early_page_initialised(pfn))
return;
if (!kmsan_memblock_free_pages(page, order)) {
/* KMSAN will take care of these pages. */
Expand Down

0 comments on commit fc57448

Please sign in to comment.