* [PATCH 1/4] mm/sparse: nr_pages won't be 0
@ 2024-06-19 1:06 Wei Yang
2024-06-19 1:06 ` [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef Wei Yang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Wei Yang @ 2024-06-19 1:06 UTC (permalink / raw)
To: rppt, akpm; +Cc: linux-mm, Wei Yang
Function subsection_map_init() is only used in free_area_init() in the
loop of for_each_mem_pfn_range(). And we are sure in each iteration of
for_each_mem_pfn_range(), start_pfn < end_pfn.
So nr_pages is not possible to be 0 and we can remove the check.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
---
mm/sparse.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mm/sparse.c b/mm/sparse.c
index de40b2c73406..f56701873ce8 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -195,9 +195,6 @@ void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages)
int end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
unsigned long nr, start_sec = pfn_to_section_nr(pfn);
- if (!nr_pages)
- return;
-
for (nr = start_sec; nr <= end_sec; nr++) {
struct mem_section *ms;
unsigned long pfns;
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef
2024-06-19 1:06 [PATCH 1/4] mm/sparse: nr_pages won't be 0 Wei Yang
@ 2024-06-19 1:06 ` Wei Yang
2024-06-23 7:48 ` Mike Rapoport
2024-06-19 1:06 ` [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag Wei Yang
2024-06-19 1:06 ` [PATCH 4/4] mm/page_alloc: reword the comment of buddy_merge_likely() Wei Yang
2 siblings, 1 reply; 6+ messages in thread
From: Wei Yang @ 2024-06-19 1:06 UTC (permalink / raw)
To: rppt, akpm; +Cc: linux-mm, Wei Yang
Current check on MAX_ZONELISTS is wrapped in CONFIG_DEBUG_MEMORY_INIT,
which may not be triggered all the time.
Let's move it out to a more general place.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Mike Rapoport (IBM) <rppt@kernel.org>
---
mm/mm_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 31ebb3cd53ac..4991cb5c5436 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -53,7 +53,6 @@ void __init mminit_verify_zonelist(void)
struct zonelist *zonelist;
int i, listid, zoneid;
- BUILD_BUG_ON(MAX_ZONELISTS > 2);
for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
/* Identify the zone and nodelist */
@@ -2668,6 +2667,7 @@ static void __init mem_init_print_info(void)
void __init mm_core_init(void)
{
/* Initializations relying on SMP setup */
+ BUILD_BUG_ON(MAX_ZONELISTS > 2);
build_all_zonelists(NULL);
page_alloc_init_cpuhp();
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag
2024-06-19 1:06 [PATCH 1/4] mm/sparse: nr_pages won't be 0 Wei Yang
2024-06-19 1:06 ` [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef Wei Yang
@ 2024-06-19 1:06 ` Wei Yang
2024-06-23 7:50 ` Mike Rapoport
2024-06-19 1:06 ` [PATCH 4/4] mm/page_alloc: reword the comment of buddy_merge_likely() Wei Yang
2 siblings, 1 reply; 6+ messages in thread
From: Wei Yang @ 2024-06-19 1:06 UTC (permalink / raw)
To: rppt, akpm; +Cc: linux-mm, Wei Yang
The GFP flags used to choose the zonelist is __GFP_THISNODE.
Let's change it to what exactly it should be.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f3ba1ede142d..594176449890 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5209,7 +5209,7 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int *node_order,
}
/*
- * Build gfp_thisnode zonelists
+ * Build __GFP_THISNODE zonelists
*/
static void build_thisnode_zonelists(pg_data_t *pgdat)
{
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] mm/page_alloc: reword the comment of buddy_merge_likely()
2024-06-19 1:06 [PATCH 1/4] mm/sparse: nr_pages won't be 0 Wei Yang
2024-06-19 1:06 ` [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef Wei Yang
2024-06-19 1:06 ` [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag Wei Yang
@ 2024-06-19 1:06 ` Wei Yang
2 siblings, 0 replies; 6+ messages in thread
From: Wei Yang @ 2024-06-19 1:06 UTC (permalink / raw)
To: rppt, akpm; +Cc: linux-mm, Wei Yang
For page with order O, we are checking its order (O + 1)'s buddy. If it
is free, we would like to put it to the tail and expect it would be
merged to a page with order (O + 2).
Reword the comment to reflect it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/page_alloc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 594176449890..d1df7929f003 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -706,12 +706,12 @@ static inline struct page *get_page_from_free_area(struct free_area *area,
}
/*
- * If this is not the largest possible page, check if the buddy
- * of the next-highest order is free. If it is, it's possible
+ * If this is less than the 2nd largest possible page, check if the buddy
+ * of the next-higher order is free. If it is, it's possible
* that pages are being freed that will coalesce soon. In case,
* that is happening, add the free page to the tail of the list
* so it's less likely to be used soon and more likely to be merged
- * as a higher order page
+ * as a 2-level higher order page
*/
static inline bool
buddy_merge_likely(unsigned long pfn, unsigned long buddy_pfn,
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef
2024-06-19 1:06 ` [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef Wei Yang
@ 2024-06-23 7:48 ` Mike Rapoport
0 siblings, 0 replies; 6+ messages in thread
From: Mike Rapoport @ 2024-06-23 7:48 UTC (permalink / raw)
To: Wei Yang; +Cc: akpm, linux-mm
On Wed, Jun 19, 2024 at 01:06:10AM +0000, Wei Yang wrote:
> Current check on MAX_ZONELISTS is wrapped in CONFIG_DEBUG_MEMORY_INIT,
> which may not be triggered all the time.
>
> Let's move it out to a more general place.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 31ebb3cd53ac..4991cb5c5436 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -53,7 +53,6 @@ void __init mminit_verify_zonelist(void)
> struct zonelist *zonelist;
> int i, listid, zoneid;
>
> - BUILD_BUG_ON(MAX_ZONELISTS > 2);
> for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
>
> /* Identify the zone and nodelist */
> @@ -2668,6 +2667,7 @@ static void __init mem_init_print_info(void)
> void __init mm_core_init(void)
> {
> /* Initializations relying on SMP setup */
> + BUILD_BUG_ON(MAX_ZONELISTS > 2);
> build_all_zonelists(NULL);
> page_alloc_init_cpuhp();
>
> --
> 2.34.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag
2024-06-19 1:06 ` [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag Wei Yang
@ 2024-06-23 7:50 ` Mike Rapoport
0 siblings, 0 replies; 6+ messages in thread
From: Mike Rapoport @ 2024-06-23 7:50 UTC (permalink / raw)
To: Wei Yang; +Cc: akpm, linux-mm
On Wed, Jun 19, 2024 at 01:06:11AM +0000, Wei Yang wrote:
> The GFP flags used to choose the zonelist is __GFP_THISNODE.
>
> Let's change it to what exactly it should be.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f3ba1ede142d..594176449890 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5209,7 +5209,7 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int *node_order,
> }
>
> /*
> - * Build gfp_thisnode zonelists
> + * Build __GFP_THISNODE zonelists
> */
> static void build_thisnode_zonelists(pg_data_t *pgdat)
> {
> --
> 2.34.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-23 7:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19 1:06 [PATCH 1/4] mm/sparse: nr_pages won't be 0 Wei Yang
2024-06-19 1:06 ` [PATCH 2/4] mm/mm_init.c: move build check on MAX_ZONELISTS out of ifdef Wei Yang
2024-06-23 7:48 ` Mike Rapoport
2024-06-19 1:06 ` [PATCH 3/4] mm/page_alloc: fix a typo in comment about GFP flag Wei Yang
2024-06-23 7:50 ` Mike Rapoport
2024-06-19 1:06 ` [PATCH 4/4] mm/page_alloc: reword the comment of buddy_merge_likely() Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox