Index: linux-2.6.16-rc1-mm2/mm/vmscan.c =================================================================== --- linux-2.6.16-rc1-mm2.orig/mm/vmscan.c 2006-01-23 10:09:27.000000000 -0800 +++ linux-2.6.16-rc1-mm2/mm/vmscan.c 2006-01-23 10:10:13.000000000 -0800 @@ -1831,6 +1831,7 @@ int zone_reclaim_mode __read_mostly; #define RECLAIM_ZONE (1<<0) /* Run shrink_cache on the zone */ #define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */ #define RECLAIM_SWAP (1<<2) /* Swap pages out during reclaim */ +#define RECLAIM_SLAB (1<<3) /* Do a global slab shrink if the zone is out of memory */ /* * Mininum time between zone reclaim scans @@ -1896,6 +1897,19 @@ int zone_reclaim(struct zone *zone, gfp_ } while (sc.nr_reclaimed < nr_pages && sc.priority > 0); + if (sc.nr_reclaimed < nr_pages && (zone_reclaim_mode & RECLAIM_SLAB)) { + /* + * shrink_slab does not currently allow us to determine + * how many pages were freed in the zone. So we just + * shake the slab and then go offnode for a single allocation. + * + * shrink_slab will free memory on all zones and may take + * a long time. + */ + shrink_slab(sc.nr_scanned, gfp_mask, order); + sc.nr_reclaimed = 1; /* Avoid getting the off node timeout */ + } + p->reclaim_state = NULL; current->flags &= ~PF_MEMALLOC; Index: linux-2.6.16-rc1-mm2/Documentation/sysctl/vm.txt =================================================================== --- linux-2.6.16-rc1-mm2.orig/Documentation/sysctl/vm.txt 2006-01-23 10:08:29.000000000 -0800 +++ linux-2.6.16-rc1-mm2/Documentation/sysctl/vm.txt 2006-01-23 10:09:33.000000000 -0800 @@ -136,6 +136,7 @@ This is a ORed together value of 1 = Zone reclaim on 2 = Zone reclaim writes dirty pages out 4 = Zone reclaim swaps pages +8 = Also do a global slab reclaim pass zone_reclaim_mode is set during bootup to 1 if it is determined that pages from remote zones will cause a significant performance reduction. The @@ -157,6 +158,11 @@ nodes from the writeout happy process. Allowing regular swap effectively restricts allocations to the local node unless explicitly overridden by memory policy. +It may be advisable to allow slab reclaim if the system makes heavy +use of files and builds up large slab caches. However, the slab +shrink operation is global, may take a long time and free slabs +in all nodes of the system. + ================================================================ zone_reclaim_interval: