From: Andrew Morton <akpm@linux-foundation.org>
To: Julian Sun <sunjunchao@bytedance.com>
Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
axboe@kernel.dk, hannes@cmpxchg.org, mhocko@kernel.org,
roman.gushchin@linux.dev, shakeel.butt@linux.dev,
muchun.song@linux.dev, willy@infradead.org, jack@suse.cz,
rostedt@goodmis.org, tj@kernel.org
Subject: Re: [PATCH v4 0/3] memcg,writeback: flush foreign bdev mappings separately
Date: Mon, 14 Sep 2026 20:59:47 -0700 [thread overview]
Message-ID: <20260914205947.5aab9d7261ef0f26ec8f3213@linux-foundation.org> (raw)
In-Reply-To: <20260914103119.1708452-1-sunjunchao@bytedance.com>
On Mon, 14 Sep 2026 18:31:16 +0800 Julian Sun <sunjunchao@bytedance.com> wrote:
> Bdev inodes are routinely shared by multiple memcgs. Recording their
> owner wb as foreign can cause dirty throttling in one memcg to trigger
> writeback of unrelated file data belonging to that wb.
>
> On one production machine, bdev mapping snapshots showed as little
> as about 10 MiB of dirty data. A queue snapshot of its owner wb showed
> 599 foreign-flush works, with an average requested writeback budget of
> 43 GiB per work.
>
> In other words, a small amount of foreign dirtying in the bdev mapping
> can trigger owner-wide writeback requests, whose budgets averaged
> 43 GiB in this queue snapshot.
What is the overall runtime effect of this? IOW, can we see some
before-and-after numbers?
> Following Jan's suggestion, this series records foreign bdev targets
> separately and flushes their mappings instead of their owner wbs. This
> preserves a way for dirty throttling to initiate bdev writeback while
> avoiding owner-wide writeback triggered by these records. The existing
> foreign-wb mechanism remains unchanged for other inodes.
>
> Tracking is best effort: each memcg keeps a bounded set of device
> numbers without persistent device or inode references. Closed devices
> and devices with a busy open_mutex are skipped. Device removal and
> device-number reuse may race with lookup.
>
> Flushes run asynchronously on a dedicated workqueue to isolate these
> frequently triggered tasks from existing workqueue users. If workqueue
> allocation fails, the existing foreign-wb mechanism remains in use.
>
> Julian Sun (3):
> block: introduce bdev_flush_by_dev()
> memcg,writeback: flush foreign bdev mappings separately from owner wbs
> writeback: record bdev targets in foreign writeback tracepoints
>
> block/bdev.c | 24 +++++++
> include/linux/blkdev.h | 1 +
> include/linux/memcontrol.h | 15 ++++
> include/trace/events/writeback.h | 22 +++---
> mm/memcontrol.c | 113 ++++++++++++++++++++++++++++---
I'd consider this a memcg patch, and not only due to the line counts.
Please cc linux-mm on memcg patchsets.
next prev parent reply other threads:[~2026-09-15 3:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 10:31 [PATCH v4 0/3] memcg,writeback: flush foreign bdev mappings separately Julian Sun
2026-09-14 10:31 ` [PATCH v4 1/3] block: introduce bdev_flush_by_dev() Julian Sun
2026-09-14 10:31 ` [PATCH v4 2/3] memcg,writeback: flush foreign bdev mappings separately from owner wbs Julian Sun
2026-09-14 10:31 ` [PATCH v4 3/3] writeback: record bdev targets in foreign writeback tracepoints Julian Sun
2026-09-15 3:59 ` Andrew Morton [this message]
2026-09-15 5:35 ` [PATCH v4 0/3] memcg,writeback: flush foreign bdev mappings separately Julian Sun
2026-09-15 6:06 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914205947.5aab9d7261ef0f26ec8f3213@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shakeel.butt@linux.dev \
--cc=sunjunchao@bytedance.com \
--cc=tj@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox