linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Julian Sun <sunjunchao@bytedance.com>
To: Tejun Heo <tj@kernel.org>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, jack@suse.cz,
	 muchun.song@linux.dev, venkat88@linux.ibm.com,
	hannes@cmpxchg.org,  mhocko@kernel.org, roman.gushchin@linux.dev,
	shakeel.butt@linux.dev,  akpm@linux-foundation.org
Subject: Re: [External] Re: [PATCH v6] memcg: Don't wait writeback completion when release memcg.
Date: Thu, 18 Sep 2025 10:27:23 +0800	[thread overview]
Message-ID: <CAHSKhtccroAB_MJ-Dz0KgKgZEOfMdqdtZZq428tULMBv2hU4=A@mail.gmail.com> (raw)
In-Reply-To: <aMstLw_ccoveLow-@slm.duckdns.org>

Hi,

On Thu, Sep 18, 2025 at 5:50 AM Tejun Heo <tj@kernel.org> wrote:
>
> Hello,
>
> On Thu, Sep 18, 2025 at 05:29:59AM +0800, Julian Sun wrote:
> ...
> > The wb_wait_for_completion() here is probably only used to prevent
> > use-after-free. Therefore, we manage 'done' separately and automatically
> > free it.
> >
> > This allows us to remove wb_wait_for_completion() while preventing
> > the use-after-free issue.
> >
> > Fixes: 97b27821b485 ("writeback, memcg: Implement foreign dirty flushing")
> > Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
>
>   Acked-by: Tejun Heo <tj@kernel.org>
>
> Minor comments below:
>
> > +/*
> > + * This structure exists to avoid waiting for writeback to finish on
> > + * memcg release, which could lead to a hang task.
>                                            ^
>                                            hung
>
> > + * @done.cnt is always > 0 before a memcg is released, so @wq_entry.func
> > + * may only be invoked by finish_writeback_work() after memcg is freed.
> > + * See mem_cgroup_css_free() for details.
> > + */
>
> I'm not sure this gives enough of a picture of what's going on. It'd be
> better to expand a bit - briefly describe what the whole mechanism is for
> and how hung tasks can happen.

Ah.. I think explaining how hungtask occurs is a bit too detailed and
verbose. If readers want to learn about more detailed content and
causes, I think the commit message would be a better choice...
>
> Thanks.
>
> --
> tejun


Thanks,
-- 
Julian Sun <sunjunchao@bytedance.com>


  reply	other threads:[~2025-09-18  2:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 21:29 Julian Sun
2025-09-17 21:50 ` Tejun Heo
2025-09-18  2:27   ` Julian Sun [this message]
2025-09-17 22:21 ` Andrew Morton
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='CAHSKhtccroAB_MJ-Dz0KgKgZEOfMdqdtZZq428tULMBv2hU4=A@mail.gmail.com' \
    --to=sunjunchao@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --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