linux-kernelorg-stable/drivers
Sergey Senozhatsky cf42d4cccf zram: modernize writeback interface
The writeback interface supports a page_index=N parameter which performs
writeback of the given page.  Since we rarely need to writeback just one
single page, the typical use case involves a number of writeback calls,
each performing writeback of one page:

  echo page_index=100 > zram0/writeback
  ...
  echo page_index=200 > zram0/writeback
  echo page_index=500 > zram0/writeback
  ...
  echo page_index=700 > zram0/writeback

One obvious downside of this is that it increases the number of syscalls. 
Less obvious, but a significantly more important downside, is that when
given only one page to post-process zram cannot perform an optimal target
selection.  This becomes a critical limitation when writeback_limit is
enabled, because under writeback_limit we want to guarantee the highest
memory savings hence we first need to writeback pages that release the
highest amount of zsmalloc pool memory.

This patch adds page_indexes=LOW-HIGH parameter to the writeback
interface:

  echo page_indexes=100-200 page_indexes=500-700 > zram0/writeback

This gives zram a chance to apply an optimal target selection strategy on
each iteration of the writeback loop.

We also now permit multiple page_index parameters per call (previously
zram would recognize only one page_index) and a mix or single pages and
page ranges:

  echo page_index=42 page_index=99 page_indexes=100-200 \
       page_indexes=500-700 > zram0/writeback

Apart from that the patch also unifies parameters passing and resembles
other "modern" zram device attributes (e.g.  recompression), while the old
interface used a mixed scheme: values-less parameters for mode and a
key=value format for page_index.  We still support the "old" value-less
format for compatibility reasons.

[senozhatsky@chromium.org: simplify parse_page_index() range checks, per Brian]
  nk: https://lkml.kernel.org/r/20250404015327.2427684-1-senozhatsky@chromium.org
[sozhatsky@chromium.org: fix uninitialized variable in zram_writeback_slots(), per Dan]
  nk: https://lkml.kernel.org/r/20250409112611.1154282-1-senozhatsky@chromium.org
Link: https://lkml.kernel.org/r/20250327015818.4148660-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Brian Geffon <bgeffon@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-05-11 17:48:09 -07:00
..
accel accel/ivpu: Correct mutex unlock order in job submission 2025-04-30 11:27:37 +02:00
accessibility treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
acpi acpi,srat: give memory block size advice based on CFMWS alignment 2025-05-11 17:48:08 -07:00
amba
android binder: fix offset calculation in debug log 2025-04-15 15:11:12 +02:00
ata ata: libata-scsi: Improve CDL control 2025-04-22 16:06:05 +09:00
atm treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
auxdisplay treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
base memory: implement memory_block_advise/probe_max_size 2025-05-11 17:48:07 -07:00
bcma
block zram: modernize writeback interface 2025-05-11 17:48:09 -07:00
bluetooth Bluetooth: btintel_pcie: Add additional to checks to clear TX/RX paths 2025-04-25 15:03:19 -04:00
bus treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
cache
cdrom
cdx
char Char/Misc driver fixes for 6.15-rc4 2025-04-25 10:30:40 -07:00
clk ARM and clkdev updates for 6.15-rc1 2025-04-03 12:21:44 -07:00
clocksource clocksource/i8253: Use raw_spinlock_irqsave() in clockevent_i8253_disable() 2025-05-05 15:34:49 +02:00
comedi comedi: jr3_pci: Fix synchronous deletion of timer 2025-04-15 15:18:55 +02:00
connector
counter Char/Misc fixes for 6.15-rc1 2025-04-02 18:03:34 -07:00
cpufreq cpufreq: intel_pstate: Unchecked MSR aceess in legacy mode 2025-04-30 16:27:34 +02:00
cpuidle
crypto crypto: atmel-sha204a - Set hwrng quality to lowest possible 2025-04-23 09:32:57 +08:00
cxl cxl/core/regs.c: Skip Memory Space Enable check for RCD and RCH Ports 2025-04-21 08:30:13 -07:00
dax
dca
devfreq
dio
dma treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
dma-buf dma-buf/sw_sync: Decrement refcount on error in sw_sync_ioctl_get_deadline() 2025-04-11 14:22:22 +02:00
dpll
edac EDAC/altera: Set DDR and SDMMC interrupt mask before registration 2025-04-28 12:38:53 +02:00
eisa
extcon
firewire treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
firmware soc: fixes for 6.14 2025-05-05 08:07:24 -07:00
fpga fpga: tests: add module descriptions 2025-04-11 17:32:38 -07:00
fsi
fwctl fwctl: Fix repeated device word in log message 2025-04-11 20:47:45 -03:00
gnss
gpio gpiolib: Allow to use setters with return value for output-only gpios 2025-04-14 20:31:00 +02:00
gpu Rust fixes for v6.15 (2nd) 2025-05-09 14:06:34 -07:00
greybus treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
hid treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
hsi treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
hte treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
hv Char/Misc/IIO driver fixes for 6.15-rc6 2025-05-10 08:55:15 -07:00
hwmon treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
hwspinlock
hwtracing intel_th: avoid using deprecated page->mapping, index fields 2025-04-15 13:29:03 +02:00
i2c i2c: omap: fix deprecated of_property_read_bool() use 2025-05-06 00:14:25 +02:00
i3c i3c: Add NULL pointer check in i3c_master_queue_ibi() 2025-03-31 11:44:00 +02:00
idle
iio IIO: 1st set of fixes for the 6.15 cycle. 2025-05-01 17:47:49 +02:00
infiniband RDMA/bnxt_re: Remove unusable nq variable 2025-04-10 14:47:55 -03:00
input Input updates for v6.15-rc5 2025-05-11 10:29:29 -07:00
interconnect
iommu IOMMU Fixes for Linux v6.15-rc4: 2025-05-02 08:57:00 -07:00
ipack
irqchip irqchip/qcom-mpm: Prevent crash when trying to handle non-wake GPIOs 2025-05-02 21:07:02 +02:00
isdn treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
leds treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
macintosh treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mailbox treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mcb mcb: fix a double free bug in chameleon_parse_gdd() 2025-04-15 18:21:39 +02:00
md - dm: fix reading past the end of allocated memory 2025-05-06 08:14:20 -07:00
media media: cec: tda9950: add back i2c dependency 2025-04-07 08:12:12 +02:00
memory treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
memstick treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
message SCSI misc on 20250326 2025-03-26 19:57:34 -07:00
mfd * Maxim MAX77705: 2025-03-29 14:33:13 -07:00
misc pci-v6.15-fixes-3 2025-04-26 13:02:36 -07:00
mmc mmc: renesas_sdhi: disable clocks if registering regulator failed 2025-04-07 17:58:41 +02:00
most treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mtd mtd: rawnand: Add status chack in r852_ready() 2025-04-07 09:02:49 +02:00
mux
net virtio-net: fix total qstat values 2025-05-08 11:56:12 +02:00
nfc treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
ntb Bug fixes for NTB Switchtec driver mw negative shift, Intel NTB link 2025-04-04 14:23:07 -07:00
nubus
nvdimm libnvdimm additions for 6.15 2025-04-02 20:27:18 -07:00
nvme block-6.15-20250509 2025-05-09 10:34:50 -07:00
nvmem nvmem: qfprom: switch to 4-byte aligned reads 2025-04-11 14:41:22 +02:00
of Devicetree for v6.15: 2025-03-29 11:23:16 -07:00
opp
parisc
parport treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
pci s390 fixes for 6.15-rc6 2025-05-08 08:29:13 -07:00
pcmcia treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
peci
perf pci-v6.15-changes 2025-03-28 19:36:53 -07:00
phy phy-for-6.15 2025-04-01 12:47:11 -07:00
pinctrl pinctrl: qcom: Fix PINGROUP definition for sm8750 2025-04-29 10:27:25 +02:00
platform platform/x86: ideapad-laptop: add support for some new buttons 2025-04-23 13:05:26 +03:00
pmdomain
pnp Staging driver updates for 6.15-rc1 2025-04-02 18:09:17 -07:00
power gcc-15: get rid of misc extra NUL character padding 2025-04-20 11:57:54 -07:00
powercap
pps pps: generators: tio: fix platform_set_drvdata() 2025-04-15 18:22:32 +02:00
ps3
ptp ptp: ocp: Fix NULL dereference in Adva board SMA sysfs operations 2025-05-01 07:01:31 -07:00
pwm pwm: A set of fixes for pwm core and various drivers 2025-04-12 08:11:19 -07:00
rapidio
ras RAS/AMD/FMPM: Get masked address 2025-04-08 19:30:58 +02:00
regulator These are objtool fixes and updates by Josh Poimboeuf, centered 2025-04-02 10:30:10 -07:00
remoteproc
reset remoteproc updates for v6.15 2025-03-29 17:18:50 -07:00
rpmsg
rtc treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
s390 s390/dcssblk: Fix build error with CONFIG_DAX=m and CONFIG_DCSSBLK=y 2025-05-05 15:46:34 +02:00
sbus
scsi SCSI fixes on 20250502 2025-05-02 11:14:58 -07:00
sh
siox
slimbus
soc soc: drivers for 6.15, part 2 2025-04-04 09:06:32 -07:00
soundwire soundwire: intel_auxdevice: Fix system suspend/resume handling 2025-04-30 16:23:37 +02:00
spi spi: Fixes for v6.15 2025-05-02 16:33:50 -07:00
spmi
ssb
staging Staging driver fixes for 6.15-rc6 2025-05-10 09:08:19 -07:00
target scsi: target: iscsi: Fix timeout on deleted connection 2025-04-11 22:13:00 -04:00
tc
tee
thermal thermal: intel: int340x: Fix Panther Lake DLVR support 2025-04-15 18:57:25 +02:00
thunderbolt USB/Thunderbolt update for 6.15-rc1 2025-04-02 18:23:31 -07:00
tty serial: sifive: lock port in startup()/shutdown() callbacks 2025-04-15 15:02:39 +02:00
ufs scsi: ufs: core: Remove redundant query_complete trace 2025-04-28 21:23:29 -04:00
uio uio_hv_generic: Fix sysfs creation path for ring buffer 2025-05-02 13:59:02 +02:00
usb xhci: dbc: Avoid event polling busyloop if pending rx transfers are inactive. 2025-05-05 16:30:45 +02:00
vdpa
vfio vfio/pci: Align huge faults to order 2025-05-06 12:59:12 -06:00
vhost vhost-scsi: Fix vhost_scsi_send_status() 2025-04-18 10:08:11 -04:00
video treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
virt treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
virtio virtgpu: don't reset on shutdown 2025-04-18 10:05:49 -04:00
w1
watchdog treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
xen xenbus: Use kref to track req lifetime 2025-05-07 16:21:41 +02:00
zorro
Kconfig
Makefile