From: Julian Sun <sunjunchao@bytedance.com>
To: Tejun Heo <tj@kernel.org>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org,
mhocko@kernel.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev, jack@suse.cz
Subject: Re: [External] Re: [PATCH v2] memcg: Don't wait writeback completion when release memcg.
Date: Thu, 28 Aug 2025 00:47:09 +0800 [thread overview]
Message-ID: <CAHSKhte2u+Af-_p4ezdGBk_R4f9EtHE7nzpys685kE2oOwY=Aw@mail.gmail.com> (raw)
In-Reply-To: <aK8xilDSEaRB3mjj@slm.duckdns.org>
Hi,
On Thu, Aug 28, 2025 at 12:25 AM Tejun Heo <tj@kernel.org> wrote:
>
> Hello,
>
> On Tue, Aug 26, 2025 at 08:16:18PM +0800, Julian Sun wrote:
> > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> > index 785173aa0739..f6dd771df369 100644
> > --- a/include/linux/memcontrol.h
> > +++ b/include/linux/memcontrol.h
> > @@ -157,11 +157,17 @@ struct mem_cgroup_thresholds {
> > */
> > #define MEMCG_CGWB_FRN_CNT 4
> >
> > +struct cgwb_frn_wq_entry {
> > + struct wb_completion *done;
> > + struct wait_queue_entry wq_entry;
> > +};
>
> Why not embed wb_completion in the sturct? Also, can you name it
> cgwb_frn_wait instead?
Sure, will update it in next version.
>
> > struct memcg_cgwb_frn {
> > u64 bdi_id; /* bdi->id of the foreign inode */
> > int memcg_id; /* memcg->css.id of foreign inode */
> > u64 at; /* jiffies_64 at the time of dirtying */
> > - struct wb_completion done; /* tracks in-flight foreign writebacks */
> > + struct wb_completion *done; /* tracks in-flight foreign writebacks */
> > + struct cgwb_frn_wq_entry *frn_wq; /* used to free resources when release memcg */
>
> And the field just "wait". I know wq is used as an abbreviation for waitq
> but it conflicts with workqueue and waitq / wait names seem clearer.
Reasonable. Will update it in next version.
>
> > +static int memcg_cgwb_waitq_callback_fn(struct wait_queue_entry *wq_entry, unsigned int mode,
> > + int flags, void *key)
> > +{
> > + struct cgwb_frn_wq_entry *frn_wq_entry = container_of(wq_entry,
> > + struct cgwb_frn_wq_entry, wq_entry);
> > +
> > + list_del_init_careful(&wq_entry->entry);
>
> Why list_del_init_careful() instead of just list_del()?
>
> > + kfree(frn_wq_entry->done);
> > + kfree(frn_wq_entry);
>
> If done is embedded, this will become one free, right?
Yes, this makes it look clearer. Thank you for your review.
>
> Thanks.
>
> --
> tejun
Thanks,
--
Julian Sun <sunjunchao@bytedance.com>
prev parent reply other threads:[~2025-08-27 16:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 12:16 [PATCH v2] memcg: Don't wait writeback completion when release memcg Julian Sun
2025-08-27 16:25 ` Tejun Heo
2025-08-27 16:47 ` Julian Sun [this message]
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='CAHSKhte2u+Af-_p4ezdGBk_R4f9EtHE7nzpys685kE2oOwY=Aw@mail.gmail.com' \
--to=sunjunchao@bytedance.com \
--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 \
/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;
as well as URLs for NNTP newsgroup(s).