[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250825122931.13037-1-wangyufei@vivo.com>
Date: Mon, 25 Aug 2025 20:29:29 +0800
From: wangyufei <wangyufei@...o.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
wangyufei <wangyufei@...o.com>,
linux-kernel@...r.kernel.org (open list),
linux-mm@...ck.org (open list:MEMORY MANAGEMENT - MISC),
linux-fsdevel@...r.kernel.org (open list:PAGE CACHE)
Cc: kundan.kumar@...sung.com,
anuj20.g@...sung.com,
hch@....de,
bernd@...ernd.com,
djwong@...nel.org,
jack@...e.cz,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org,
opensource.kernel@...o.com
Subject: [RFC 0/1] writeback: add sysfs to config the number of writeback contexts
Hi everyone,
We've been interested in this patch about parallelizing writeback [1]
and have been following its discussion and development. Our testing in
several application scenarios on mobile devices has shown significant
performance improvements.
Currently, we're focusing on how the number of writeback contexts impacts
the performance on different filesystems and storage workloads. We noticed
the previous discussion about making the number of writeback contexts an
opt-in configuration to adapt to different filesystems [2]. Currently, it
can only be set via a sysfs interface at system initialization. We'd like
to discuss the possibility of supporting dynamic runtime configuration of
the number of writeback contexts.
We have developed a mechanism that allows the number of writeback contexts
to be configured at runtime via a sysfs interface. To configure, use:
echo <nr_wb_ctx> > /sys/class/bdi/<dev>/nwritebacks.
Our implementation supports *increasing* the number of writeback contexts.
This is achieved by dynamically allocating new writeback contexts and
replacing the existing bdi->wb_ctx_arr and bdi->nr_wb_ctx. But we have
not yet solved the problem of safely *reducing* the bdi->nr_wb_ctx.
Several challenges remain:
- How should we safely handle ongoing I/Os when contexts are removed?
- What is the correct way to migrate pending writeback tasks and related
resources to other writeback contexts?
- Should this be a per-device or global setting?
We're sharing this early implementation to gather feedback on:
1. Is runtime configurability of writeback contexts a worthwhile goal?
2. How should we handle synchronization and migration when dynamically
changing the bdi->nr_wb_ctx, particularly when removing the active
writeback contexts?
3. Any better tests to validate the stability of this approach?
We look forward to feedback and suggestions for further improvements.
[1] Parallelizing filesystem writeback :
https://lore.kernel.org/linux-fsdevel/20250529111504.89912-1-kundan.kumar@samsung.com/
[2] The discussion on configuration of the number of writeback contexts :
https://lore.kernel.org/linux-fsdevel/20250609040056.GA26101@lst.de/
wangyufei (1):
writeback: add sysfs to config the number of writeback contexts
include/linux/backing-dev.h | 3 ++
mm/backing-dev.c | 59 +++++++++++++++++++++++++++++++++++
mm/page-writeback.c | 61 +++++++++++++++++++++++++++++++++++++
3 files changed, 123 insertions(+)
--
2.39.0
Powered by blists - more mailing lists