Commit 768c4fcc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] vm: scan slab in response to highmem scanning

The patch which went in six months or so back which said "only reclaim slab
if we're scanning lowmem pagecache" was wrong.  I must have been asleep at
the time.

We do need to scan slab in response to highmem page reclaim as well.  Because
all the math is based around the total amount of memory in the machine, and
we know that if we're performing highmem page reclaim then the lower zones
have no free memory.
parent a5cc10d5
...@@ -872,12 +872,10 @@ int try_to_free_pages(struct zone **zones, ...@@ -872,12 +872,10 @@ int try_to_free_pages(struct zone **zones,
get_page_state(&ps); get_page_state(&ps);
nr_reclaimed += shrink_caches(zones, priority, &total_scanned, nr_reclaimed += shrink_caches(zones, priority, &total_scanned,
gfp_mask, nr_pages, &ps); gfp_mask, nr_pages, &ps);
if (zones[0] - zones[0]->zone_pgdat->node_zones < ZONE_HIGHMEM) { shrink_slab(total_scanned, gfp_mask);
shrink_slab(total_scanned, gfp_mask); if (reclaim_state) {
if (reclaim_state) { nr_reclaimed += reclaim_state->reclaimed_slab;
nr_reclaimed += reclaim_state->reclaimed_slab; reclaim_state->reclaimed_slab = 0;
reclaim_state->reclaimed_slab = 0;
}
} }
if (nr_reclaimed >= nr_pages) { if (nr_reclaimed >= nr_pages) {
ret = 1; ret = 1;
...@@ -964,11 +962,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps) ...@@ -964,11 +962,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
max_scan = SWAP_CLUSTER_MAX; max_scan = SWAP_CLUSTER_MAX;
reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL, reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,
to_reclaim, &total_scanned, ps); to_reclaim, &total_scanned, ps);
if (i < ZONE_HIGHMEM) { reclaim_state->reclaimed_slab = 0;
reclaim_state->reclaimed_slab = 0; shrink_slab(total_scanned, GFP_KERNEL);
shrink_slab(total_scanned, GFP_KERNEL); reclaimed += reclaim_state->reclaimed_slab;
reclaimed += reclaim_state->reclaimed_slab;
}
to_free -= reclaimed; to_free -= reclaimed;
if (zone->all_unreclaimable) if (zone->all_unreclaimable)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment