linux-stable/drivers/staging
Johannes Weiner 6b4f7799c6 mm: vmscan: invoke slab shrinkers from shrink_zone()
The slab shrinkers are currently invoked from the zonelist walkers in
kswapd, direct reclaim, and zone reclaim, all of which roughly gauge the
eligible LRU pages and assemble a nodemask to pass to NUMA-aware
shrinkers, which then again have to walk over the nodemask.  This is
redundant code, extra runtime work, and fairly inaccurate when it comes to
the estimation of actually scannable LRU pages.  The code duplication will
only get worse when making the shrinkers cgroup-aware and requiring them
to have out-of-band cgroup hierarchy walks as well.

Instead, invoke the shrinkers from shrink_zone(), which is where all
reclaimers end up, to avoid this duplication.

Take the count for eligible LRU pages out of get_scan_count(), which
considers many more factors than just the availability of swap space, like
zone_reclaimable_pages() currently does.  Accumulate the number over all
visited lruvecs to get the per-zone value.

Some nodes have multiple zones due to memory addressing restrictions.  To
avoid putting too much pressure on the shrinkers, only invoke them once
for each such node, using the class zone of the allocation as the pivot
zone.

For now, this integrates the slab shrinking better into the reclaim logic
and gets rid of duplicative invocations from kswapd, direct reclaim, and
zone reclaim.  It also prepares for cgroup-awareness, allowing
memcg-capable shrinkers to be added at the lruvec level without much
duplication of both code and runtime work.

This changes kswapd behavior, which used to invoke the shrinkers for each
zone, but with scan ratios gathered from the entire node, resulting in
meaningless pressure quantities on multi-zone nodes.

Zone reclaim behavior also changes.  It used to shrink slabs until the
same amount of pages were shrunk as were reclaimed from the LRUs.  Now it
merely invokes the shrinkers once with the zone's scan ratio, which makes
the shrinkers go easier on caches that implement aging and would prefer
feeding back pressure from recently used slab objects to unused LRU pages.

[vdavydov@parallels.com: assure class zone is populated]
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 12:42:48 -08:00
..
android mm: vmscan: invoke slab shrinkers from shrink_zone() 2014-12-13 12:42:48 -08:00
bcm Staging: bcm: Removed unnecessary else. 2014-10-02 09:33:46 -07:00
board
comedi staging: comedi: fix memory leak / bad pointer freeing for chanlist 2014-10-29 16:18:31 +08:00
cptm1217
dgap staging: dgap: use dgap_release_remap() in dgap_cleanup_board() 2014-09-23 23:39:25 -07:00
dgnc TTY/Serial driver patches for 3.18-rc1 2014-10-08 06:52:11 -04:00
emxx_udc staging: emxx_udc: Use min_t instead of min 2014-10-02 13:51:03 -07:00
ft1000 staging: ft1000: ft1000-usb: Removed unnecessary else statement. 2014-10-02 10:13:37 -07:00
fwserial
gdm72xx drivers: staging: gdm72xx: Removed unnecessary braces. 2014-09-28 23:27:35 -04:00
gdm724x staging: gdm724x: Removed unnecessary else expression. 2014-09-28 23:27:34 -04:00
goldfish
gs_fpgaboot staging: gs_fpgaboot Fix trailing whitespace. 2014-09-19 17:42:15 -07:00
iio ARM: SoC DT updates for 3.19 2014-12-09 14:57:37 -08:00
imx-drm Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-10-14 09:39:08 +02:00
line6 staging: line6: fix midibuf.c coding style issue 2014-09-23 23:41:25 -07:00
lustre Merge branch 'for-lustre' into for-next 2014-11-19 13:01:59 -05:00
media [media] mn88473: One function call less in mn88473_init() after error 2014-12-04 16:00:47 -02:00
mt29f_spinand
netlogic staging: netlogic: fix checkpatch.pl "LINE_SPACING" issuses 2014-09-08 14:02:13 -07:00
nvec
octeon staging: octeon: Combined seperate strings. 2014-10-02 09:59:20 -07:00
octeon-usb Staging: octeon-hcd: removed dummy label 2014-09-11 14:49:13 -07:00
olpc_dcon
ozwpan staging: ozwpan: Remove typedefs 2014-09-28 22:03:58 -04:00
panel
rtl8188eu staging: r8188eu: Add new device ID for DLink GO-USB-N150 2014-11-27 08:55:01 -08:00
rtl8192e staging: rtl8192e: use %*pEn to escape buffer 2014-10-14 02:18:27 +02:00
rtl8192u staging: rtl8192u: use %*pEn to escape buffer 2014-10-14 02:18:27 +02:00
rtl8712 staging: rtl8712: Fixed else not required after return 2014-10-02 11:59:40 -07:00
rtl8723au Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-11-14 01:01:12 -05:00
rts5208 staging: rts5208: remove unnecessary else 2014-10-02 10:07:04 -07:00
skein staging: skein: replace spaces with tabs 2014-09-19 17:27:28 -07:00
slicoss staging: slicoss: Fix void function return statements style warning 2014-09-28 23:36:24 -04:00
speakup staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h> 2014-10-02 10:09:01 -07:00
ste_rmi4 Staging: ste_rmi4: add new line after declarations 2014-09-23 13:44:11 -07:00
unisys staging: unisys: Fix CamelCase in uislib_force_channel_interrupt() 2014-10-02 09:49:29 -07:00
vme Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
vt6655 staging: vt6655: Fixed C99 // comment errors in wpactl.c 2014-10-02 10:11:26 -07:00
vt6656 mac80211: allow drivers to support NL80211_SCAN_FLAG_RANDOM_ADDR 2014-11-19 18:46:09 +01:00
wlan-ng staging: wlan-ng: use %*pEhp to print SN 2014-10-14 02:18:27 +02:00
xgifb
Kconfig staging: et131x: Remove et131x driver from drivers/staging 2014-10-03 13:55:14 -07:00
Makefile staging: et131x: Remove et131x driver from drivers/staging 2014-10-03 13:55:14 -07:00
staging.c