Could we add wb_pending_pages to memory.events?
Very cheap and useful.
A single atomic counter is already kept internally; exposing it is one
line in memcontrol.c plus one line in the ABI doc.
On 8/20/2025 3:19 PM, Julian Sun wrote:
This patch series aims to eliminate task hangs in mem_cgroup_css_free()
caused by calling wb_wait_for_completion().
This is because there may be a large number of writeback tasks in the
foreign memcg, involving millions of pages, and the situation is
exacerbated by WBT rate limiting—potentially leading to task hangs
lasting several hours.
Patch 1 is preparatory work and involves no functional changes.
Patch 2 implements the automatic release of wb_completion.
Patch 3 removes wb_wait_for_completion() from mem_cgroup_css_free().
Julian Sun (3):
writeback: Rename wb_writeback_work->auto_free to free_work.
writeback: Add wb_writeback_work->free_done
memcg: Don't wait writeback completion when release memcg.
fs/fs-writeback.c | 22 ++++++++++++++--------
include/linux/backing-dev-defs.h | 6 ++++++
include/linux/memcontrol.h | 2 +-
mm/memcontrol.c | 29 ++++++++++++++++++++---------
4 files changed, 41 insertions(+), 18 deletions(-)