[PATCH v8 0/3] xenbus/backend: Add a memory pressure handler callback

From: SeongJae Park
Date: Fri Dec 13 2019 - 08:02:35 EST


Granting pages consumes backend system memory. In systems configured
with insufficient spare memory for those pages, it can cause a memory
pressure situation. However, finding the optimal amount of the spare
memory is challenging for large systems having dynamic resource
utilization patterns. Also, such a static configuration might lack
flexibility.

To mitigate such problems, this patchset adds a memory reclaim callback
to 'xenbus_driver' (patch 1) and use it to mitigate the problem in
'xen-blkback' (patch 2). The third patch is a trivial cleanup of
variable names.

Base Version
------------

This patch is based on v5.4. A complete tree is also available at my
public git repo:
https://github.com/sjp38/linux/tree/blkback_squeezing_v8


Patch History
-------------

Changes from v7
(https://lore.kernel.org/xen-devel/20191211181016.14366-1-sjpark@xxxxxxxxx/)
- Update sysfs-driver-xen-blkback for new parameter
(suggested by Roger Pau MonnÃ)
- Use per-xen_blkif buffer_squeeze_end instead of global variable
(suggested by Roger Pau MonnÃ)

Changes from v6
(https://lore.kernel.org/linux-block/20191211042428.5961-1-sjpark@xxxxxxxxx/)
- Remove more unnecessary prefixes (suggested by Roger Pau MonnÃ)
- Constify a variable (suggested by Roger Pau MonnÃ)
- Rename 'reclaim' into 'reclaim_memory' (suggested by Roger Pau MonnÃ)
- More wordsmith of the commit message (suggested by Roger Pau MonnÃ)

Changes from v5
(https://lore.kernel.org/linux-block/20191210080628.5264-1-sjpark@xxxxxxxxx/)
- Wordsmith the commit messages (suggested by Roger Pau MonnÃ)
- Change the reclaim callback return type (suggested by Roger Pau MonnÃ)
- Change the type of the blkback squeeze duration variable
(suggested by Roger Pau MonnÃ)
- Add a patch for removal of unnecessary static variable name prefixes
(suggested by Roger Pau MonnÃ)
- Fix checkpatch.pl warnings

Changes from v4
(https://lore.kernel.org/xen-devel/20191209194305.20828-1-sjpark@xxxxxxxxxx/)
- Remove domain id parameter from the callback (suggested by Juergen Gross)
- Rename xen-blkback module parameter (suggested by Stefan Nuernburger)

Changes from v3
(https://lore.kernel.org/xen-devel/20191209085839.21215-1-sjpark@xxxxxxxxxx/)
- Add general callback in xen_driver and use it (suggested by Juergen Gross)

Changes from v2
(https://lore.kernel.org/linux-block/af195033-23d5-38ed-b73b-f6e2e3b34541@xxxxxxxxxx)
- Rename the module parameter and variables for brevity
(aggressive shrinking -> squeezing)

Changes from v1
(https://lore.kernel.org/xen-devel/20191204113419.2298-1-sjpark@xxxxxxxxxx/)
- Adjust the description to not use the term, `arbitrarily`
(suggested by Paul Durrant)
- Specify time unit of the duration in the parameter description,
(suggested by Maximilian Heyne)
- Change default aggressive shrinking duration from 1ms to 10ms
- Merge two patches into one single patch

SeongJae Park (3):
xenbus/backend: Add memory pressure handler callback
xen/blkback: Squeeze page pools if a memory pressure is detected
xen/blkback: Remove unnecessary static variable name prefixes

.../ABI/testing/sysfs-driver-xen-blkback | 9 +++
drivers/block/xen-blkback/blkback.c | 57 ++++++++++++-------
drivers/block/xen-blkback/common.h | 2 +
drivers/block/xen-blkback/xenbus.c | 11 +++-
drivers/xen/xenbus/xenbus_probe_backend.c | 32 +++++++++++
include/xen/xenbus.h | 1 +
6 files changed, 90 insertions(+), 22 deletions(-)

--
2.17.1