From: SeongJae Park <sjpark@xxxxxxxxx> As discussed by the previous commit ("xen/blkback: Aggressively shrink page pools if a memory pressure is detected"), the aggressive pool shrinking duration should be carefully selected: ``If it is too long, free pages pool shrinking overhead can reduce the I/O performance. If it is too short, blkback will not free enough pages to reduce the memory pressure.`` That said, the proper duration would depends on given configurations and workloads. For the reason, this commit allows users to set it via a module parameter interface. Signed-off-by: SeongJae Park <sjpark@xxxxxxxxx> Suggested-by: Amit Shah <aams@xxxxxxxxx> --- drivers/block/xen-blkback/blkback.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index aa1a127093e5..88c011300ee9 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -137,9 +137,13 @@ module_param(log_stats, int, 0644); /* * Once a memory pressure is detected, keep aggressive shrinking of the free - * page pools for this time (msec) + * page pools for this time (milliseconds) */ -#define AGGRESSIVE_SHRINKING_DURATION 1 +static int xen_blkif_aggressive_shrinking_duration = 1; +module_param_named(aggressive_shrinking_duration, + xen_blkif_aggressive_shrinking_duration, int, 0644); +MODULE_PARM_DESC(aggressive_shrinking_duration, +"Duration to do aggressive shrinking when a memory pressure is detected"); static unsigned long xen_blk_mem_pressure_end; @@ -147,7 +151,7 @@ static unsigned long blkif_shrink_count(struct shrinker *shrinker, struct shrink_control *sc) { xen_blk_mem_pressure_end = jiffies + - msecs_to_jiffies(AGGRESSIVE_SHRINKING_DURATION); + msecs_to_jiffies(xen_blkif_aggressive_shrinking_duration); return 0; } -- 2.17.1