From: Andrew Morton <akpm@linux-foundation.org>
To: Julian Sun <sunjunchao@bytedance.com>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, jack@suse.cz,
tj@kernel.org, muchun.song@linux.dev, venkat88@linux.ibm.com,
hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, Lance Yang <lance.yang@linux.dev>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH v6] memcg: Don't wait writeback completion when release memcg.
Date: Wed, 17 Sep 2025 15:21:55 -0700 [thread overview]
Message-ID: <20250917152155.5a8ddb3e4ff813289ea0b4c9@linux-foundation.org> (raw)
In-Reply-To: <20250917212959.355656-1-sunjunchao@bytedance.com>
On Thu, 18 Sep 2025 05:29:59 +0800 Julian Sun <sunjunchao@bytedance.com> wrote:
> Recently, we encountered the following hung task:
>
> INFO: task kworker/4:1:1334558 blocked for more than 1720 seconds.
> [Wed Jul 30 17:47:45 2025] Workqueue: cgroup_destroy css_free_rwork_fn
>
> ...
>
> The direct cause is that memcg spends a long time waiting for dirty page
> writeback of foreign memcgs during release.
>
> The root causes are:
> a. The wb may have multiple writeback tasks, containing millions
> of dirty pages, as shown below:
>
> >>> for work in list_for_each_entry("struct wb_writeback_work", \
> wb.work_list.address_of_(), "list"):
> ... print(work.nr_pages, work.reason, hex(work))
> ...
> 900628 WB_REASON_FOREIGN_FLUSH 0xffff969e8d956b40
> 1116521 WB_REASON_FOREIGN_FLUSH 0xffff9698332a9540
>
> ...
>
I don't think it's particularly harmful that a dedicated worker thread
has to wait for a long time in this fashion. It doesn't have anything
else to do (does it?) and a blocked kernel thread is cheap.
> 3085016 WB_REASON_FOREIGN_FLUSH 0xffff969f0455e000
> 3035712 WB_REASON_FOREIGN_FLUSH 0xffff969d9bbf4b00
>
> b. The writeback might severely throttled by wbt, with a speed
> possibly less than 100kb/s, leading to a very long writeback time.
>
> ...
>
> include/linux/memcontrol.h | 14 +++++++++-
> mm/memcontrol.c | 57 ++++++++++++++++++++++++++++++++------
> 2 files changed, 62 insertions(+), 9 deletions(-)
Seems we're adding a bunch of tricky code to fix a non-problem which
the hung-task detector undesirably reports.
Would a better fix be to simply suppress the warning?
I don't think we presently have a touch_hung_task_detector() (do we?)
but it's presumably pretty simple. And maybe
touch_softlockup_watchdog) should be taught to call that
touch_hung_task_dectector().
Another approach might be to set some flag in the task_struct
instructing the hung task detector to ignore this thread.
next prev parent reply other threads:[~2025-09-17 22:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 21:29 [PATCH v6] memcg: Don't wait writeback completion when release memcg Julian Sun
2025-09-17 21:50 ` Tejun Heo
2025-09-18 2:27 ` [External] " Julian Sun
2025-09-17 22:21 ` Andrew Morton [this message]
2025-09-18 2:43 ` Lance Yang
2025-09-18 3:03 ` [External] " Julian Sun
2025-09-18 3:26 ` Andrew Morton
2025-09-18 4:22 ` Julian Sun
2025-09-18 4:32 ` 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=20250917152155.5a8ddb3e4ff813289ea0b4c9@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=lance.yang@linux.dev \
--cc=linux-mm@kvack.org \
--cc=mhiramat@kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=sunjunchao@bytedance.com \
--cc=tj@kernel.org \
--cc=venkat88@linux.ibm.com \
/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