* [PATCH] mm/page_alloc: invert logic for early page initialisation checks
@ 2023-01-04 19:18 Mike Rapoport
2023-01-05 8:44 ` Anshuman Khandual
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mike Rapoport @ 2023-01-04 19:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Mel Gorman, Mike Rapoport, linux-mm, linux-kernel
From: "Mike Rapoport (IBM)" <rppt@kernel.org>
Rename early_page_uninitialised() to early_page_initialised() and invert
its logic to make the code more readable.
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
mm/page_alloc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0745aedebb37..a881f2d42b2c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;
}
/*
@@ -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)
@@ -1641,7 +1641,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);
@@ -1804,7 +1804,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. */
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/page_alloc: invert logic for early page initialisation checks
2023-01-04 19:18 [PATCH] mm/page_alloc: invert logic for early page initialisation checks Mike Rapoport
@ 2023-01-05 8:44 ` Anshuman Khandual
2023-01-05 12:59 ` David Hildenbrand
2023-01-09 13:31 ` Mel Gorman
2 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2023-01-05 8:44 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton; +Cc: Mel Gorman, linux-mm, linux-kernel
On 1/5/23 00:48, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
>
> Rename early_page_uninitialised() to early_page_initialised() and invert
> its logic to make the code more readable.
>
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
LGTM
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> mm/page_alloc.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0745aedebb37..a881f2d42b2c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -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;
> }
>
> /*
> @@ -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)
> @@ -1641,7 +1641,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);
> @@ -1804,7 +1804,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. */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/page_alloc: invert logic for early page initialisation checks
2023-01-04 19:18 [PATCH] mm/page_alloc: invert logic for early page initialisation checks Mike Rapoport
2023-01-05 8:44 ` Anshuman Khandual
@ 2023-01-05 12:59 ` David Hildenbrand
2023-01-09 13:31 ` Mel Gorman
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2023-01-05 12:59 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton; +Cc: Mel Gorman, linux-mm, linux-kernel
On 04.01.23 20:18, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
>
> Rename early_page_uninitialised() to early_page_initialised() and invert
> its logic to make the code more readable.
>
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/page_alloc: invert logic for early page initialisation checks
2023-01-04 19:18 [PATCH] mm/page_alloc: invert logic for early page initialisation checks Mike Rapoport
2023-01-05 8:44 ` Anshuman Khandual
2023-01-05 12:59 ` David Hildenbrand
@ 2023-01-09 13:31 ` Mel Gorman
2 siblings, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2023-01-09 13:31 UTC (permalink / raw)
To: Mike Rapoport; +Cc: Andrew Morton, linux-mm, linux-kernel
On Wed, Jan 04, 2023 at 09:18:05PM +0200, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
>
> Rename early_page_uninitialised() to early_page_initialised() and invert
> its logic to make the code more readable.
>
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Acked-by: Mel Gorman <mgorman@suse.de>
--
Mel Gorman
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-09 13:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 19:18 [PATCH] mm/page_alloc: invert logic for early page initialisation checks Mike Rapoport
2023-01-05 8:44 ` Anshuman Khandual
2023-01-05 12:59 ` David Hildenbrand
2023-01-09 13:31 ` Mel Gorman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox