linux/drivers
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
..
accessibility
acpi ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
amba ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
ata Merge branch 'for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2014-12-11 18:52:37 -08:00
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-11-29 20:47:48 -08:00
auxdisplay
base memory-hotplug: remove redundant call of page_to_pfn 2014-12-13 12:42:47 -08:00
bcma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
block virtio: virtio 1.0 support, misc patches 2014-12-11 12:20:31 -08:00
bluetooth Bluetooth: Add support for Broadcom BCM20702A0 variants firmware download 2014-12-03 19:40:44 +01:00
bus ARM: SoC driver updates for 3.19 2014-12-09 14:48:22 -08:00
cdrom
char virtio: virtio 1.0 support, misc patches 2014-12-11 12:20:31 -08:00
clk Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
clocksource Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
connector
cpufreq Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
cpuidle
crypto
dca
devfreq
dio
dma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
dma-buf
edac edac updates for v3.19-rc1 2014-12-11 11:58:50 -08:00
eisa
extcon
firewire
firmware There was a lot of clean ups and minor fixes. One of those clean ups was 2014-12-10 19:58:13 -08:00
fmc
gpio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2014-12-12 10:26:47 -08:00
hsi hsi / OMAP / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM 2014-12-04 01:07:01 +01:00
hv hyperv: Add support for vNIC hot removal 2014-12-08 20:24:11 -05:00
hwmon hwmon: (tmp401) Detect TMP435 on all addresses it supports 2014-12-08 06:48:37 -08:00
hwspinlock
i2c Devicetree changes for v3.19 2014-12-11 13:06:58 -08:00
ide
idle
iio Hi Linus, 2014-12-08 20:02:54 -08:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
input Merge branch 'pm-runtime' 2014-12-08 20:00:44 +01:00
iommu iommu/amd: use handle_mm_fault directly 2014-12-13 12:42:47 -08:00
ipack
irqchip Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
isdn Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
leds leds: leds-gpio: Fix multiple instances registration without 'label' property 2014-12-04 02:28:19 +01:00
lguest virtio: allow finalize_features to fail 2014-12-09 16:32:32 +02:00
macintosh
mailbox Mailbox: Add support for Platform Communication Channel 2014-11-27 12:51:09 +05:30
mcb
md - Significant DM thin-provisioning performance improvements to meet 2014-12-08 21:10:03 -08:00
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
memory ARM: SoC/OMAP GPMC driver cleanup and move for 3.19 2014-12-09 16:57:56 -08:00
memstick
message
mfd Devicetree changes for v3.19 2014-12-11 13:06:58 -08:00
misc powerpc updates for 3.19 2014-12-11 17:48:14 -08:00
mmc ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
mtd
net Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
nfc NFC: st21nfcb: Fix reported error 2014-12-02 22:49:11 +01:00
ntb
nubus
of Devicetree changes for v3.19 2014-12-11 13:06:58 -08:00
oprofile
parisc
parport
pci xen: features and fixes for 3.19-rc0 2014-12-11 18:15:33 -08:00
pcmcia
phy
pinctrl Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
platform
pnp
power ARM: SoC platform changes for 3.19 2014-12-09 14:38:28 -08:00
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: Updates for v3.19 2014-12-08 20:42:41 -08:00
remoteproc virtio: virtio 1.0 support, misc patches 2014-12-11 12:20:31 -08:00
reset Reset controller changes for v3.19 2014-12-04 16:57:36 +01:00
rpmsg
rtc rtc: snvs: fix build with CONFIG_PM_SLEEP disabled 2014-12-13 12:42:45 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
sbus
scsi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
sfi
sh drivers: sh / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM 2014-12-05 03:08:24 +01:00
sn
soc ARM: SoC driver updates for 3.19 2014-12-09 14:48:22 -08:00
spi Devicetree changes for v3.19 2014-12-11 13:06:58 -08:00
spmi
ssb Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-12-11 17:56:37 -08:00
staging mm: vmscan: invoke slab shrinkers from shrink_zone() 2014-12-13 12:42:48 -08:00
target Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
tc
thermal
thunderbolt
tty Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
uio
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2014-12-12 10:26:47 -08:00
uwb
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
video Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-12-12 10:08:06 -08:00
virt
virtio virtio_pci: rename virtio_pci -> virtio_pci_common 2014-12-09 21:42:05 +02:00
vlynq
vme
w1
watchdog Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 08:18:32 -08:00
xen xen: features and fixes for 3.19-rc0 2014-12-11 18:15:33 -08:00
zorro
Kconfig ARM: tegra: Move AHB Kconfig to drivers/amba 2014-11-26 09:43:25 +01:00
Makefile