

+#define LOOP_IDLE_WORKER_TIMEOUT (60 * HZ) Implementation serializes all I/O through a single thread anyways, so Iĭrivers/block/loop.c | 207 ++++++++++++++++++++++++++++++++++++-Ģ files changed, 182 insertions(+), 37 deletions(-)ĭiff -git a/drivers/block/loop.c b/drivers/block/loop.c The locking for the tree and queues is fairly heavy handed - we acquireĪ per-loop-device spinlock any time either is accessed. There is also a single queue for I/O associated with the rootcg whichĬan be used in cases of extreme memory shortage where we cannot allocate This allows each cgroup to independently makeįorward progress issuing I/O to the backing file. The loop device maintains a tree mapping blkĬss_id -> loop_worker. Where each work item is a "struct loop_worker" which contains a queue of In order to avoid this priority inversion, we use a single workqueue Synchronously blocked, holding up all other I/O to the loop device. Simply charging resources for I/O to the backingįile could result in priority inversion where one cgroup gets ` (2 subsequent siblings) 3 siblings, 1 reply 29+ messages in threadĮxisting uses of loop device may have multiple cgroups reading/writing 15:36 ` mm: Charge active memcg when no mm is set Dan Schatzberg 6:03 ` eaba742710: WARNING:at_kernel/workqueue.c:#check_flush_dependency kernel test robot 15:36 Charge loop device i/o to issuing cgroup Dan 15:36 ` Dan Schatzberg * loop: Use worker per cgroup instead of kworker Loop: Use worker per cgroup instead of kworker

When writing through the loop device as expected.
PATCH FOR DELL AIO 924 PATCH
With this patch series applied, the above script triggers OOM kills
PATCH FOR DELL AIO 924 DRIVER
Minor modification to the loop driver so that each cgroup can makeįorward progress independently to avoid this inversion. The single kworker thread in the case where multiple cgroups are Naively charging cgroups could result in priority inversions through # Set a memory limit, write more than that limit through loopbackĭd if=/dev/zero of=$LOOP_DEV bs=1M count=256 # Set a memory limit, write more than that limit to tmpfs -> OOM killĭd if=/dev/zero of=/tmp/file bs=1M count=256" || true This patch series fixes this gap in accounting.Ī simple script to demonstrate this behavior on cgroupv2 machine:

ThisĪllows a loop device to be used to trivially bypass resource limitsĪnd other policy. Thread which results in all i/o being charged to the root cgroup. The loop device runs all i/o to the backing file on a separate kworker * Add mem_css to struct loop_cmd to simplify logic Separate from kworker -> workqueue change * Split out and reordered patches so cgroup charging changes are * Deferred destruction of workqueue items so in the common case there * Ensure charge on shmem_swapin_page works just like getpage * Fix race on loop device destruction and deferred worker cleanup * Added support for nesting memalloc_use_memcg * Fixed a missing css_put when failing to allocate a worker * Added separate spinlock for worker synchronization * Rebased on top of Roman Gushchin's patch * Rebased against linus's branch which now includes Roman Gushchin's * Added page-cache charging to mm: Charge active memcg when no mm is set No major changes, just rebasing and resubmitting Open list, open list:CONTROL GROUP (CGROUP), Roman Gushchin, Muchun Song, Alex Shi, Alexander Duyck,Ĭhris Down, Yafang Shao, Wei Yang, open list:BLOCK LAYER, Michal Hocko, Vladimir Davydov, Hugh Dickins, Shakeel Butt, ` (3 more replies) 0 siblings, 4 replies 29+ messages in threadįrom: Dan Schatzberg 15:36 UTC ( / raw)Ĭc: Jens Axboe, Tejun Heo, Zefan Li, Johannes Weiner, Andrew Morton, 15:36 ` loop: Use worker per cgroup instead of kworker Dan Schatzberg
PATCH FOR DELL AIO 924 ARCHIVE
Charge loop device i/o to issuing cgroup LKML Archive on help / color / mirror / Atom feed * Charge loop device i/o to issuing cgroup 15:36 Dan Schatzberg
