diff options
-rw-r--r-- | mm/vmscan.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 16180587fd7d..ba18d0c36b83 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -62,6 +62,8 @@ struct scan_control { | |||
62 | int swap_cluster_max; | 62 | int swap_cluster_max; |
63 | 63 | ||
64 | int swappiness; | 64 | int swappiness; |
65 | |||
66 | int all_unreclaimable; | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | /* | 69 | /* |
@@ -925,6 +927,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones, | |||
925 | unsigned long nr_reclaimed = 0; | 927 | unsigned long nr_reclaimed = 0; |
926 | int i; | 928 | int i; |
927 | 929 | ||
930 | sc->all_unreclaimable = 1; | ||
928 | for (i = 0; zones[i] != NULL; i++) { | 931 | for (i = 0; zones[i] != NULL; i++) { |
929 | struct zone *zone = zones[i]; | 932 | struct zone *zone = zones[i]; |
930 | 933 | ||
@@ -941,6 +944,8 @@ static unsigned long shrink_zones(int priority, struct zone **zones, | |||
941 | if (zone->all_unreclaimable && priority != DEF_PRIORITY) | 944 | if (zone->all_unreclaimable && priority != DEF_PRIORITY) |
942 | continue; /* Let kswapd poll it */ | 945 | continue; /* Let kswapd poll it */ |
943 | 946 | ||
947 | sc->all_unreclaimable = 0; | ||
948 | |||
944 | nr_reclaimed += shrink_zone(priority, zone, sc); | 949 | nr_reclaimed += shrink_zone(priority, zone, sc); |
945 | } | 950 | } |
946 | return nr_reclaimed; | 951 | return nr_reclaimed; |
@@ -1021,6 +1026,9 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask) | |||
1021 | if (sc.nr_scanned && priority < DEF_PRIORITY - 2) | 1026 | if (sc.nr_scanned && priority < DEF_PRIORITY - 2) |
1022 | blk_congestion_wait(WRITE, HZ/10); | 1027 | blk_congestion_wait(WRITE, HZ/10); |
1023 | } | 1028 | } |
1029 | /* top priority shrink_caches still had more to do? don't OOM, then */ | ||
1030 | if (!sc.all_unreclaimable) | ||
1031 | ret = 1; | ||
1024 | out: | 1032 | out: |
1025 | for (i = 0; zones[i] != 0; i++) { | 1033 | for (i = 0; zones[i] != 0; i++) { |
1026 | struct zone *zone = zones[i]; | 1034 | struct zone *zone = zones[i]; |