vmscan: fix missing place to check nr_swap_pages.
Subsystems (3)
PATCH 1/1 vmscan: fix missing place to check nr_swap_pages.
Fix a missed place where checks nr_swap_pages to do shrink_active_list. Make the change that moves the check to common function inactive_anon_is_low.
--- mm/vmscan.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
mm/vmscan.c +4 -1
@@ -1605,6 +1605,9 @@ static int inactive_anon_is_low(struct zone *zone, struct scan_control *sc) {int low; +if (nr_swap_pages <=0 ) +return 0 ; +if (scanning_global_lru (sc)) low =inactive_anon_is_low_global (zone);else
@@ -1856,7 +1859,7 @@ static void shrink_zone(int priority, struct zone *zone,* Even if we did not try to evict anon pages at all, we want to * rebalance the anon lru active/inactive ratio. */ -if (inactive_anon_is_low (zone, sc) && nr_swap_pages >0 ) +if (inactive_anon_is_low (zone, sc))shrink_active_list (SWAP_CLUSTER_MAX , zone, sc, priority,0 );throttle_vm_writeout (sc->gfp_mask);
Signature · 7 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hello.
Quoted 3 lines · Ying Han
Fix a missed place where checks
nr_swap_pagesto doshrink_active_list. Make the change that moves the check to common functioninactive_anon_is_low.
Hmm.. AFAIR, we discussed it at that time but we concluded it's not good. That's because nr_swap_pages < 0 means both "NO SWAP" and "NOT enough swap space now". If we have a swap device or file but not enough space now, we need to aging anon pages to make inactive list enough size. Otherwise, working set pages would be swapped out more fast before promotion.
That aging is done by kswapd so I think it's not big harmful in the system. But if you want to remove aging completely in non-swap system, we need to identify non swap system and not enough swap space. I thought we need it for embedded system.
Thanks.
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Minchan Kim
Hello.
Quoted 3 lines · Ying Han
Fix a missed place where checks
nr_swap_pagesto doshrink_active_list. Make the change that moves the check to common functioninactive_anon_is_low.
Quoted 6 lines
Hmm.. AFAIR, we discussed it at that time but we concluded it's not good. That's because
nr_swap_pages< 0 means both "NO SWAP" and "NOT enough swap space now". If we have a swap device or file but not enough space now, we need to aging anon pages to make inactive list enough size. Otherwise, working set pages would be swapped out more fast before promotion.
We found the problem on one of our workloads where more TLB flush happens without the change. Kswapd seems to be calling shrink_active_list() which eventually clears access bit of those ptes and does TLB flush
with ptep_clear_flush_young(). This system does not have swap configured, and why aging the anon lru in that
case?
Quoted 4 lines
That aging is done by kswapd so I think it's not big harmful in the system. But if you want to remove aging completely in non-swap system, we need to identify non swap system and not enough swap space. I thought we need it for embedded system.
Lots of TLB flush hurts the performance especially on large smp system. So does it make sense if change it to:
+ if (nr_swap_pages == 0)
+ return 0;
--Ying
Quoted 7 lines
Thanks.
--
Kind regards,
Minchan Kim
Quoted 6 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 16 lines · Ying Han
Quoted 8 lines · Minchan Kim
Hello.
Quoted 3 lines · Ying Han
Fix a missed place where checks
nr_swap_pagesto doshrink_active_list. Make the change that moves the check to common functioninactive_anon_is_low.Quoted 6 lines
Hmm.. AFAIR, we discussed it at that time but we concluded it's not good. That's because
nr_swap_pages< 0 means both "NO SWAP" and "NOT enough swap space now". If we have a swap device or file but not enough space now, we need to aging anon pages to make inactive list enough size. Otherwise, working set pages would be swapped out more fast before promotion.
Quoted 7 lines
We found the problem on one of our workloads where more TLB flush happens without the change. Kswapd seems to be calling
shrink_active_list()which eventually clears access bit of those ptes and does TLB flush
withptep_clear_flush_young(). This system does not have swap configured, and why aging the anon lru in that
case?
True. I also wanted it but we have to care swap configured but non-enabling still yet system as well as non-swap configured system at that time.
If your system is no swap configured, how about this?
(It's a not formal proper patch but just quick patch to show the concept).
mm/vmscan.c +0 -0
@@ -1580,6 +1580,11 @@ static void shrink_active_list(unsigned long
nr_pages, struct zone *zone,
spin_unlock_irq(&zone->lru_lock);
}
+/*
+ * If system doesn't have a swap configuration,
+ * it doesn't need to age anon pages in kswapd.
+ */
+#ifdef CONFIG_SWAP
static int inactive_anon_is_low_global(struct zone *zone)
{
unsigned long active, inactive;
@@ -1611,6 +1616,12 @@ static int inactive_anon_is_low(struct zone
*zone, struct scan_control *sc)
low = mem_cgroup_inactive_anon_is_low(sc->mem_cgroup);
return low; }
+#else
+static inline int inactive_anon_is_low(struct zone *zone, struct scan_control *sc)
+{
+ return 0;
+}
+#endif
static int inactive_file_is_low_global(struct zone *zone) {
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 26 lines · Minchan Kim
Quoted 16 lines · Ying Han
Quoted 8 lines · Minchan Kim
Hello.
Quoted 3 lines · Ying Han
Fix a missed place where checks
nr_swap_pagesto doshrink_active_list. Make the change that moves the check to common functioninactive_anon_is_low.Quoted 6 lines
Hmm.. AFAIR, we discussed it at that time but we concluded it's not good. That's because
nr_swap_pages< 0 means both "NO SWAP" and "NOT enough swap space now". If we have a swap device or file but not enough space now, we need to aging anon pages to make inactive list enough size. Otherwise, working set pages would be swapped out more fast before promotion.Quoted 7 lines
We found the problem on one of our workloads where more TLB flush happens without the change. Kswapd seems to be calling
shrink_active_list()which eventually clears access bit of those ptes and does TLB flush
withptep_clear_flush_young(). This system does not have swap configured, and why aging the anon lru in that
case?
Quoted 3 lines
True. I also wanted it but we have to care swap configured but non-enabling still yet system as well as non-swap configured system at that time.
Agree. In our case, we cares about the case where swap is not enabled but is configured .
Quoted 3 lines
If your system is no swap configured, how about this?
(It's a not formal proper patch but just quick patch to show the concept).
In our system, we do have swap configured. In vmscan.c, there are couple of places where we skip scanning
and shrinking anon lru while the condition if(nr_swap_pages <= 0) is true. It still make sense to me to add it
to the shrink_active() condition as the initial patch.
Also, we found it is quite often to hit the condition inactive_anon_is_low on machine with small numa node size, since the zone->inactive_ratio is set based on the zone->present_pages.
--Ying
Quoted 38 lines
mm/vmscan.c +5
-0@@ -1580,6 +1580,11 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, spin_unlock_irq(&zone->lru_lock); } +/* +* If system doesn't have a swap configuration, +* it doesn't need to age anon pages in kswapd. +*/ +#ifdef CONFIG_SWAP static int inactive_anon_is_low_global(struct zone *zone) {unsigned long active, inactive;
mm/vmscan.c +6
-0@@ -1611,6 +1616,12 @@ static int inactive_anon_is_low(struct zone *zone, struct scan_control *sc) low = mem_cgroup_inactive_anon_is_low(sc->mem_cgroup); return low; } +#else +static inline int inactive_anon_is_low (struct zone *zone,struct scan_control *sc) +{ + return 0; +} +#endif static int
inactive_file_is_low_global(struct zone *zone){--
Kind regards,
Minchan Kim
Quoted 10 lines · Ying Han
Quoted 9 lines · Minchan Kim
Quoted 7 lines · Ying Han
Quoted 6 lines · Minchan Kim
Hello.
Quoted 2 lines · Ying Han
Fix a missed place where checks
nr_swap_pagesto doshrink_active_list. Make the change that moves the check to common functioninactive_anon_is_low
Quoted 7 lines · Venkatesh Pallipadi
Quoted 6 lines · Ying Han
In our system, we do have swap configured. In
vmscan.c, there are couple of places where we skip scanning
and shrinking anon lru while the conditionif(nr_swap_pages <= 0)is true. It still make sense to me to add it
to theshrink_active()condition as the initial patch.
Quoted 6 lines
Quoted 4 lines
Also, we found it is quite often to hit the condition
inactive_anon_is_lowon machine with small numa node size, since thezone->inactive_ratiois set based on thezone->present_pages.Does "
total_swap_pages" help?
Yes. Thanks for advising.
Quoted 3 lines
Thanks,
Venki
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Ying Han
Also, we found it is quite often to hit the condition
inactive_anon_is_lowon machine with small numa node size, since thezone->inactive_ratiois set based on thezone->present_pages.
What's your memory configuration and memory size?
Now we have zoned page allocator and zoned page reclaimer. So it makes sense to me. :)
Anyway, I will resend new version. Thanks, Ying.
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>