linux-uconsole/drivers
Suren Baghdasaryan cbb1cc722a dm bufio: fix shrinker scans when (nr_to_scan < retain_target)
commit fbc7c07ec2 upstream.

When system is under memory pressure it is observed that dm bufio
shrinker often reclaims only one buffer per scan. This change fixes
the following two issues in dm bufio shrinker that cause this behavior:

1. ((nr_to_scan - freed) <= retain_target) condition is used to
terminate slab scan process. This assumes that nr_to_scan is equal
to the LRU size, which might not be correct because do_shrink_slab()
in vmscan.c calculates nr_to_scan using multiple inputs.
As a result when nr_to_scan is less than retain_target (64) the scan
will terminate after the first iteration, effectively reclaiming one
buffer per scan and making scans very inefficient. This hurts vmscan
performance especially because mutex is acquired/released every time
dm_bufio_shrink_scan() is called.
New implementation uses ((LRU size - freed) <= retain_target)
condition for scan termination. LRU size can be safely determined
inside __scan() because this function is called after dm_bufio_lock().

2. do_shrink_slab() uses value returned by dm_bufio_shrink_count() to
determine number of freeable objects in the slab. However dm_bufio
always retains retain_target buffers in its LRU and will terminate
a scan when this mark is reached. Therefore returning the entire LRU size
from dm_bufio_shrink_count() is misleading because that does not
represent the number of freeable objects that slab will reclaim during
a scan. Returning (LRU size - retain_target) better represents the
number of freeable objects in the slab. This way do_shrink_slab()
returns 0 when (LRU size < retain_target) and vmscan will not try to
scan this shrinker avoiding scans that will not reclaim any memory.

Test: tested using Android device running
<AOSP>/system/extras/alloc-stress that generates memory pressure
and causes intensive shrinker scans

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-17 09:35:24 +01:00
..
accessibility
acpi ACPI: APEI / ERST: Fix missing error handling in erst_reader() 2018-01-02 20:33:19 +01:00
amba
android ANDROID: binder: fix proc->tsk check. 2017-08-30 10:19:26 +02:00
ata libata: drop WARN from protocol error in ata_sff_qc_issue() 2017-12-16 10:33:52 +01:00
atm atm: horizon: Fix irq release error 2017-12-16 10:33:55 +01:00
auxdisplay
base isa: Prevent NULL dereference in isa_bus driver callbacks 2017-12-16 10:33:48 +01:00
bcma bcma: use (get|put)_device when probing/removing device driver 2017-03-12 06:37:30 +01:00
block zram: set physical queue limits to avoid array out of bounds accesses 2017-12-16 10:33:53 +01:00
bluetooth Revert "Bluetooth: btusb: driver to enable the usb-wakeup feature" 2017-12-25 14:22:15 +01:00
bus sunxi-rsb: Include OF based modalias in device uevent 2018-01-10 09:27:09 +01:00
cdrom
char ipmi: Stop timers before cleaning up the module 2017-12-16 10:33:56 +01:00
clk clk: tegra: Fix cclk_lp divisor register 2017-12-20 10:04:59 +01:00
clocksource clockevents/drivers/cs5535: Improve resilience to spurious interrupts 2017-10-27 10:23:17 +02:00
connector
cpufreq cpufreq: CPPC: add ACPI_PROCESSOR dependency 2017-10-21 17:09:06 +02:00
cpuidle cpuidle: fix broadcast control when broadcast can not be entered 2017-12-25 14:22:15 +01:00
crypto crypto: n2 - cure use after free 2018-01-10 09:27:08 +01:00
dca
devfreq
dio
dma dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type 2017-12-20 10:04:58 +01:00
dma-buf
edac EDAC, i5000, i5400: Fix definition of NRECMEMB register 2017-12-16 10:33:54 +01:00
eisa
extcon extcon: palmas: Check the parent instance to prevent the NULL 2017-11-21 09:21:18 +01:00
firewire firewire: net: fix fragmented datagram_size off-by-one 2016-11-10 16:36:35 +01:00
firmware efi/esrt: Cleanup bad memory map log messages 2017-12-20 10:04:56 +01:00
fmc
fpga
gpio gpio: altera: Use handle_level_irq when configured as a level_high 2017-12-16 10:33:51 +01:00
gpu drm/radeon: reinstate oland workaround for sclk 2017-12-20 10:04:55 +01:00
hid HID: xinmo: fix for out of range for THT 2P arcade controller. 2017-12-25 14:22:12 +01:00
hsi
hv Drivers: hv: fcopy: restore correct transfer length 2017-10-12 11:27:33 +02:00
hwmon hwmon: (asus_atk0110) fix uninitialized data access 2017-12-25 14:22:12 +01:00
hwspinlock
hwtracing intel_th: pci: Add Gemini Lake support 2017-12-20 10:04:54 +01:00
i2c i2c: riic: fix restart condition 2017-12-16 10:33:53 +01:00
ide
idle intel_idle: Support for Intel Xeon Phi Processor x200 Product Family 2016-09-15 08:27:46 +02:00
iio iio: light: fix improper return value 2017-11-30 08:37:27 +00:00
infiniband iw_cxgb4: Only validate the MSN for successful completions 2018-01-02 20:33:22 +01:00
input Input: elantech - add new icbody type 15 2018-01-10 09:27:12 +01:00
iommu iommu/vt-d: Fix scatterlist offset handling 2017-12-16 10:33:49 +01:00
ipack
irqchip irqchip/crossbar: Fix incorrect type of register size 2017-12-16 10:33:52 +01:00
isdn isdn: kcapi: avoid uninitialized data 2017-12-25 14:22:13 +01:00
leds leds: ktd2692: avoid harmless maybe-uninitialized warning 2017-05-14 13:32:55 +02:00
lguest
lightnvm lightnvm: put bio before return 2016-09-24 10:07:35 +02:00
macintosh
mailbox mailbox: handle empty message in tx_tick 2017-08-06 19:19:41 -07:00
mcb
md dm bufio: fix shrinker scans when (nr_to_scan < retain_target) 2018-01-17 09:35:24 +01:00
media media: dvb: i2c transfers over usb cannot be done from stack 2017-12-16 10:33:49 +01:00
memory ARM: OMAP2+: gpmc-onenand: propagate error on initialization failure 2017-12-16 10:33:51 +01:00
memstick memstick: rtsx_usb_ms: Manage runtime PM when accessing the device 2016-10-28 03:01:35 -04:00
message
mfd mfd: twl6040: Fix child-node lookup 2018-01-02 20:33:20 +01:00
misc cxl: Check if vphb exists before iterating over AFU devices 2017-12-25 14:22:08 +01:00
mmc mmc: mediatek: Fixed bug where clock frequency could be set wrong 2017-12-20 10:04:55 +01:00
mtd mtd: nand: Fix writing mtdoops to nand flash. 2017-12-05 11:22:51 +01:00
net net: phy: micrel: ksz9031: reconfigure autoneg after phy autoneg workaround 2018-01-02 20:33:26 +01:00
nfc nfc: fdp: fix NULL pointer dereference 2017-08-06 19:19:40 -07:00
ntb ntb_transport: fix bug calculating num_qps_mw 2017-08-30 10:19:29 +02:00
nubus
nvdimm libnvdimm, namespace: make 'resource' attribute only readable by root 2017-11-30 08:37:23 +00:00
nvme nvme: Fix memory order on async queue deletion 2017-11-24 08:32:25 +01:00
nvmem nvmem: imx-ocotp: Fix wrong register size 2017-08-06 19:19:46 -07:00
of of: device: Export of_device_{get_modalias, uvent_modalias} to modules 2017-07-27 15:06:09 -07:00
oprofile
parisc parisc: Hide Diva-built-in serial aux and graphics card 2018-01-02 20:33:20 +01:00
parport parisc, parport_gsc: Fixes for printk continuation lines 2017-06-17 06:39:37 +02:00
pci PCI / PM: Force devices to D0 in pci_pm_thaw_noirq() 2018-01-02 20:33:20 +01:00
pcmcia
perf drivers/perf: arm_pmu: Fix leak in error path 2016-10-07 15:23:41 +02:00
phy phy: qcom-usb-hs: Add depends on EXTCON 2017-05-14 13:32:57 +02:00
pinctrl pinctrl: st: add irq_request/release_resources callbacks 2017-12-25 14:22:11 +01:00
platform platform/x86: hp-wmi: Do not shadow error values 2017-11-15 17:13:11 +01:00
pnp
power power: supply: bq24190_charger: Handle fault before status on interrupt 2017-05-14 13:32:54 +02:00
powercap
pps
ps3
ptp
pwm pwm: pca9685: Fix period change with same duty cycle 2017-03-15 09:57:14 +08:00
rapidio
ras
regulator regulator: fan53555: fix I2C device ids 2017-11-02 09:40:50 +01:00
remoteproc
reset
rpmsg
rtc rtc: set the alarm to the next expiring timer 2017-12-25 14:22:15 +01:00
s390 s390/qeth: no ETH header for outbound AF_IUCV 2017-12-25 14:22:12 +01:00
sbus
scsi scsi: lpfc: PLOGI failures during NPIV testing 2017-12-25 14:22:15 +01:00
sfi
sh
sn
soc soc: qcom/spm: shut up uninitialized variable warning 2016-09-24 10:07:42 +02:00
spi spi: xilinx: Detect stall with Unknown commands 2018-01-02 20:33:21 +01:00
spmi spmi: Include OF based modalias in device uevent 2017-07-27 15:06:10 -07:00
ssb ssb: Fix error routine when fallback SPROM fails 2017-01-09 08:07:42 +01:00
staging vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend 2017-12-20 10:05:01 +01:00
target target/file: Do not return error for UNMAP if length is zero 2017-12-20 10:04:58 +01:00
tc
thermal thermal: hisilicon: Handle return value of clk_prepare_enable 2017-12-25 14:22:15 +01:00
thunderbolt
tty n_tty: fix EXTPROC vs ICANON interaction with TIOCINQ (aka FIONREAD) 2018-01-02 20:33:28 +01:00
uio uio: fix dmem_region_start computation 2016-10-31 04:13:59 -06:00
usb usb: xhci: Add XHCI_TRUST_TX_LENGTH for Renesas uPD720201 2018-01-02 20:33:28 +01:00
uwb uwb: ensure that endpoint is interrupt 2017-10-12 11:27:35 +02:00
vfio vfio-pci: Handle error from pci_iomap 2017-08-06 19:19:46 -07:00
vhost fix a page leak in vhost_scsi_iov_to_sgl() error recovery 2017-11-30 08:37:22 +00:00
video backlight: pwm_bl: Fix overflow condition 2017-12-25 14:22:13 +01:00
virt
virtio virtio: release virtio index when fail to device_register 2017-12-16 10:33:48 +01:00
vlynq
vme vme: Fix wrong pointer utilization in ca91cx42_slave_get 2017-01-19 20:17:21 +01:00
w1 w1: ds2490: USB transfer buffers need to be DMAable 2017-03-12 06:37:29 +01:00
watchdog watchdog: kempld: fix gcc-4.3 build 2017-10-21 17:09:04 +02:00
xen xen: xenbus driver must not accept invalid transaction ids 2017-11-30 08:37:28 +00:00
zorro
Kconfig
Makefile usb: Make sure usb/phy/of gets built-in 2017-05-20 14:26:59 +02:00