diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index bd9a72bc4a1b..dcd90c891d8e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2656,7 +2656,7 @@ static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, | |||
2656 | * should make reasonable progress. | 2656 | * should make reasonable progress. |
2657 | */ | 2657 | */ |
2658 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | 2658 | for_each_zone_zonelist_nodemask(zone, z, zonelist, |
2659 | gfp_mask, nodemask) { | 2659 | gfp_zone(gfp_mask), nodemask) { |
2660 | if (zone_idx(zone) > ZONE_NORMAL) | 2660 | if (zone_idx(zone) > ZONE_NORMAL) |
2661 | continue; | 2661 | continue; |
2662 | 2662 | ||
@@ -2921,18 +2921,20 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining, | |||
2921 | return false; | 2921 | return false; |
2922 | 2922 | ||
2923 | /* | 2923 | /* |
2924 | * There is a potential race between when kswapd checks its watermarks | 2924 | * The throttled processes are normally woken up in balance_pgdat() as |
2925 | * and a process gets throttled. There is also a potential race if | 2925 | * soon as pfmemalloc_watermark_ok() is true. But there is a potential |
2926 | * processes get throttled, kswapd wakes, a large process exits therby | 2926 | * race between when kswapd checks the watermarks and a process gets |
2927 | * balancing the zones that causes kswapd to miss a wakeup. If kswapd | 2927 | * throttled. There is also a potential race if processes get |
2928 | * is going to sleep, no process should be sleeping on pfmemalloc_wait | 2928 | * throttled, kswapd wakes, a large process exits thereby balancing the |
2929 | * so wake them now if necessary. If necessary, processes will wake | 2929 | * zones, which causes kswapd to exit balance_pgdat() before reaching |
2930 | * kswapd and get throttled again | 2930 | * the wake up checks. If kswapd is going to sleep, no process should |
2931 | * be sleeping on pfmemalloc_wait, so wake them now if necessary. If | ||
2932 | * the wake up is premature, processes will wake kswapd and get | ||
2933 | * throttled again. The difference from wake ups in balance_pgdat() is | ||
2934 | * that here we are under prepare_to_wait(). | ||
2931 | */ | 2935 | */ |
2932 | if (waitqueue_active(&pgdat->pfmemalloc_wait)) { | 2936 | if (waitqueue_active(&pgdat->pfmemalloc_wait)) |
2933 | wake_up(&pgdat->pfmemalloc_wait); | 2937 | wake_up_all(&pgdat->pfmemalloc_wait); |
2934 | return false; | ||
2935 | } | ||
2936 | 2938 | ||
2937 | return pgdat_balanced(pgdat, order, classzone_idx); | 2939 | return pgdat_balanced(pgdat, order, classzone_idx); |
2938 | } | 2940 | } |