mm/vmscan: reclaim only affects managed_zones
Subsystems (5)
PATCH v2 1/2 mm/vmscan: reclaim only affects managed_zones
As mentioned in commit 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") , reclaim only affects managed_zones.
Let's adjust the code and comment accordingly.
--- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmscan.c +2 -2
@@ -1040,7 +1040,7 @@ static bool skip_throttle_noprogress(pg_data_t *pgdat)for (i =0 ; i <MAX_NR_ZONES ; i++) {struct zone *zone = pgdat->node_zones + i; -if (!populated_zone (zone)) +if (!managed_zone (zone))continue ; reclaimable +=zone_reclaimable_pages (zone);
@@ -3909,7 +3909,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx) }/* -* If a node has no populated zone within highest_zoneidx, it does not +* If a node has no managed zone within highest_zoneidx, it does not * need balancing by definition. This can happen if a zone-restricted * allocation tries to wake a remote kswapd. */
Signature · 1 line
2.33.1
PATCH v2 2/2 mm/vmscan: make sure wakeup_kswapd with managed zone
wakeup_kswapd() only wake up kswapd when the zone is managed.
For two callers of wakeup_kswapd(), they are node perspective.
* wake_all_kswapds
* numamigrate_isolate_page
If we picked up a !managed zone, this is not we expected.
This patch makes sure we pick up a managed zone for wakeup_kswapd(). And it also use managed_zone in migrate_balanced_pgdat() to get the proper zone.
---
v2: adjust the usage in migrate_balanced_pgdat()
--- mm/migrate.c | 6 +++--- mm/page_alloc.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
mm/migrate.c +3 -3
@@ -1971,7 +1971,7 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,#ifdef CONFIG_NUMA_BALANCING /* * Returns true if this is a safe migration target node for misplaced NUMA -* pages. Currently it only checks the watermarks which crude +* pages. Currently it only checks the watermarks which is crude. */ static bool migrate_balanced_pgdat (struct pglist_data *pgdat,unsigned long nr_migrate_pages)
@@ -1981,7 +1981,7 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat,for (z = pgdat->nr_zones -1 ; z >=0 ; z--) {struct zone *zone = pgdat->node_zones + z; -if (!populated_zone (zone)) +if (!managed_zone (zone))continue ;/* Avoid waking kswapd by allocating pages_to_migrate pages. */
@@ -2046,7 +2046,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)if (!(sysctl_numa_balancing_mode &NUMA_BALANCING_MEMORY_TIERING ))return 0 ;for (z = pgdat->nr_zones -1 ; z >=0 ; z--) { -if (populated_zone (pgdat->node_zones + z)) +if (managed_zone (pgdat->node_zones + z))break ; }wakeup_kswapd (pgdat->node_zones + z,0 , order,ZONE_MOVABLE );
mm/page_alloc.c +2 -0
@@ -4674,6 +4674,8 @@ static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask,for_each_zone_zonelist_nodemask (zone, z, ac->zonelist, highest_zoneidx, ac->nodemask) { +if (!managed_zone (zone)) +continue ;if (last_pgdat != zone->zone_pgdat)wakeup_kswapd (zone, gfp_mask, order, highest_zoneidx); last_pgdat = zone->zone_pgdat;
Signature · 1 line
2.33.1
Re: [Patch v2 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone
Quoted 13 lines · Wei Yang
wakeup_kswapd()only wake up kswapd when the zone is managed.For two callers of
wakeup_kswapd(), they are node perspective.*
wake_all_kswapds
*numamigrate_isolate_pageIf we picked up a !managed zone, this is not we expected.
This patch makes sure we pick up a managed zone for
wakeup_kswapd(). And it also usemanaged_zoneinmigrate_balanced_pgdat()to get the proper zone.
Quoted 7 lines
Signed-off-by Wei Yang <[email protected]>Cc Miaohe Lin <[email protected]>Cc David Hildenbrand <[email protected]>Cc "Huang, Ying" <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Signed-off-by Andrew Morton <[email protected]>
LGTM, Thanks!
Quoted 53 lines
---
v2: adjust the usage inmigrate_balanced_pgdat()--- mm/migrate.c | 6 +++--- mm/page_alloc.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)mm/migrate.c +3
-3@@ -1971,7 +1971,7 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,#ifdef CONFIG_NUMA_BALANCING /* * Returns true if this is a safe migration target node for misplaced NUMA -* pages. Currently it only checks the watermarks which crude +* pages. Currently it only checks the watermarks which is crude. */ static bool migrate_balanced_pgdat (struct pglist_data *pgdat,unsigned long nr_migrate_pages)@@ -1981,7 +1981,7 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat,for (z = pgdat->nr_zones -1 ; z >=0 ; z--) {struct zone *zone = pgdat->node_zones + z; -if (!populated_zone (zone)) +if (!managed_zone (zone))continue ;/* Avoid waking kswapd by allocating pages_to_migrate pages. */ @@ -2046,7 +2046,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)if (!(sysctl_numa_balancing_mode &NUMA_BALANCING_MEMORY_TIERING ))return 0 ;for (z = pgdat->nr_zones -1 ; z >=0 ; z--) { -if (populated_zone (pgdat->node_zones + z)) +if (managed_zone (pgdat->node_zones + z))break ; }wakeup_kswapd (pgdat->node_zones + z,0 , order,ZONE_MOVABLE );mm/page_alloc.c +2
-0@@ -4674,6 +4674,8 @@ static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask,for_each_zone_zonelist_nodemask (zone, z, ac->zonelist, highest_zoneidx, ac->nodemask) { +if (!managed_zone (zone)) +continue ;if (last_pgdat != zone->zone_pgdat)wakeup_kswapd (zone, gfp_mask, order, highest_zoneidx); last_pgdat = zone->zone_pgdat;
Re: [Patch v2 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone
In reply to Wei YangQuoted 7 lines · Wei Yang
wakeup_kswapd()only wake up kswapd when the zone is managed.For two callers of
wakeup_kswapd(), they are node perspective.*
wake_all_kswapds
*numamigrate_isolate_page
Quoted 7 lines
If we picked up a !managed zone, this is not we expected.
This patch makes sure we pick up a managed zone for
wakeup_kswapd(). And it also usemanaged_zoneinmigrate_balanced_pgdat()to get the proper zone.Signed-off-by Wei Yang <[email protected]>
Looks good to me. Thanks!
Quoted 60 lines
Cc Miaohe Lin <[email protected]>Cc David Hildenbrand <[email protected]>Cc "Huang, Ying" <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
v2: adjust the usage inmigrate_balanced_pgdat()--- mm/migrate.c | 6 +++--- mm/page_alloc.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)mm/migrate.c +3
-3@@ -1971,7 +1971,7 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,#ifdef CONFIG_NUMA_BALANCING /* * Returns true if this is a safe migration target node for misplaced NUMA -* pages. Currently it only checks the watermarks which crude +* pages. Currently it only checks the watermarks which is crude. */ static bool migrate_balanced_pgdat (struct pglist_data *pgdat,unsigned long nr_migrate_pages)@@ -1981,7 +1981,7 @@ static bool migrate_balanced_pgdat(struct pglist_data *pgdat,for (z = pgdat->nr_zones -1 ; z >=0 ; z--) {struct zone *zone = pgdat->node_zones + z; -if (!populated_zone (zone)) +if (!managed_zone (zone))continue ;/* Avoid waking kswapd by allocating pages_to_migrate pages. */ @@ -2046,7 +2046,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)if (!(sysctl_numa_balancing_mode &NUMA_BALANCING_MEMORY_TIERING ))return 0 ;for (z = pgdat->nr_zones -1 ; z >=0 ; z--) { -if (populated_zone (pgdat->node_zones + z)) +if (managed_zone (pgdat->node_zones + z))break ; }wakeup_kswapd (pgdat->node_zones + z,0 , order,ZONE_MOVABLE );mm/page_alloc.c +2
-0@@ -4674,6 +4674,8 @@ static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask,for_each_zone_zonelist_nodemask (zone, z, ac->zonelist, highest_zoneidx, ac->nodemask) { +if (!managed_zone (zone)) +continue ;if (last_pgdat != zone->zone_pgdat)wakeup_kswapd (zone, gfp_mask, order, highest_zoneidx); last_pgdat = zone->zone_pgdat;
Re: [Patch v2 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone
In reply to Wei YangQuoted 13 lines · Wei Yang
wakeup_kswapd()only wake up kswapd when the zone is managed.For two callers of
wakeup_kswapd(), they are node perspective.*
wake_all_kswapds
*numamigrate_isolate_pageIf we picked up a !managed zone, this is not we expected.
This patch makes sure we pick up a managed zone for
wakeup_kswapd(). And it also usemanaged_zoneinmigrate_balanced_pgdat()to get the proper zone.
Quoted 7 lines
Signed-off-by Wei Yang <[email protected]>Cc Miaohe Lin <[email protected]>Cc David Hildenbrand <[email protected]>Cc "Huang, Ying" <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Signed-off-by Andrew Morton <[email protected]>
^ I'm not so sure about that SOB, actually Andrew should add that. But maybe there is good reason for it that I'm not aware of.
Signature · 3 lines
Thanks, David / dhildenb
Re: [Patch v2 2/2] mm/vmscan: make sure wakeup_kswapd with managed zone
Quoted 22 lines · David Hildenbrand
Quoted 13 lines · Wei Yang
wakeup_kswapd()only wake up kswapd when the zone is managed.For two callers of
wakeup_kswapd(), they are node perspective.*
wake_all_kswapds
*numamigrate_isolate_pageIf we picked up a !managed zone, this is not we expected.
This patch makes sure we pick up a managed zone for
wakeup_kswapd(). And it also usemanaged_zoneinmigrate_balanced_pgdat()to get the proper zone.Quoted 7 lines
Signed-off-by Wei Yang <[email protected]>Cc Miaohe Lin <[email protected]>Cc David Hildenbrand <[email protected]>Cc "Huang, Ying" <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Signed-off-by Andrew Morton <[email protected]>
Quoted 3 lines
^ I'm not so sure about that SOB, actually Andrew should add that. But maybe there is good reason for it that I'm not aware of.
I see Andrew has added this for v1.
Maybe I should remove this since v2 has some minor adjustment to v1. :-)
Quoted 7 lines
Reviewed-by David Hildenbrand <[email protected]>Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me