mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-04 00:03:25 -04:00
[PATCH] oom: use unreclaimable info
__alloc_pages currently starts shooting if page reclaim has failed to free up swap_cluster_max pages in one run through the priorities. This is not always a good indicator on its own, so make use of the all_unreclaimable logic as well: don't consider going OOM until all zones we're interested in are unreclaimable. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
6ddab3b9eb
commit
408d85441c
1 changed files with 8 additions and 0 deletions
|
@ -62,6 +62,8 @@ struct scan_control {
|
||||||
int swap_cluster_max;
|
int swap_cluster_max;
|
||||||
|
|
||||||
int swappiness;
|
int swappiness;
|
||||||
|
|
||||||
|
int all_unreclaimable;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -925,6 +927,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
|
||||||
unsigned long nr_reclaimed = 0;
|
unsigned long nr_reclaimed = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
sc->all_unreclaimable = 1;
|
||||||
for (i = 0; zones[i] != NULL; i++) {
|
for (i = 0; zones[i] != NULL; i++) {
|
||||||
struct zone *zone = zones[i];
|
struct zone *zone = zones[i];
|
||||||
|
|
||||||
|
@ -941,6 +944,8 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
|
||||||
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
|
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
|
||||||
continue; /* Let kswapd poll it */
|
continue; /* Let kswapd poll it */
|
||||||
|
|
||||||
|
sc->all_unreclaimable = 0;
|
||||||
|
|
||||||
nr_reclaimed += shrink_zone(priority, zone, sc);
|
nr_reclaimed += shrink_zone(priority, zone, sc);
|
||||||
}
|
}
|
||||||
return nr_reclaimed;
|
return nr_reclaimed;
|
||||||
|
@ -1021,6 +1026,9 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
|
||||||
if (sc.nr_scanned && priority < DEF_PRIORITY - 2)
|
if (sc.nr_scanned && priority < DEF_PRIORITY - 2)
|
||||||
blk_congestion_wait(WRITE, HZ/10);
|
blk_congestion_wait(WRITE, HZ/10);
|
||||||
}
|
}
|
||||||
|
/* top priority shrink_caches still had more to do? don't OOM, then */
|
||||||
|
if (!sc.all_unreclaimable)
|
||||||
|
ret = 1;
|
||||||
out:
|
out:
|
||||||
for (i = 0; zones[i] != 0; i++) {
|
for (i = 0; zones[i] != 0; i++) {
|
||||||
struct zone *zone = zones[i];
|
struct zone *zone = zones[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue