linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Julian Sun <sunjunchao@bytedance.com>
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, jack@suse.cz,
	muchun.song@linux.dev, venkat88@linux.ibm.com
Subject: Re: [PATCH v5] memcg: Don't wait writeback completion when release memcg.
Date: Wed, 17 Sep 2025 08:31:14 -1000	[thread overview]
Message-ID: <aMr-chVzDBfU7BvF@slm.duckdns.org> (raw)
In-Reply-To: <20250917150125.331701-1-sunjunchao@bytedance.com>

Hello,

A couple minor points:

> +struct cgwb_frn_wait {
> +	struct wb_completion done;
> +	struct wait_queue_entry wq_entry;
> +};

Can you add a comment on top of cgwb_frn_wait to explain how it's used and
why?

> @@ -3912,8 +3940,21 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
>  	int __maybe_unused i;
>  
>  #ifdef CONFIG_CGROUP_WRITEBACK
> -	for (i = 0; i < MEMCG_CGWB_FRN_CNT; i++)
> -		wb_wait_for_completion(&memcg->cgwb_frn[i].done);
> +	spin_lock(&memcg_cgwb_frn_waitq.lock);
> +	for (i = 0; i < MEMCG_CGWB_FRN_CNT; i++) {
> +		struct cgwb_frn_wait *wait = memcg->cgwb_frn[i].wait;
> +
> +		/*
> +		 * Not necessary to wait for wb completion which might cause task hung,
> +		 * only used to free resources. See memcg_cgwb_waitq_callback_fn().
> +		 */
> +		__add_wait_queue_entry_tail(wait->done.waitq, &wait->wq_entry);
> +		if (atomic_dec_and_test(&wait->done.cnt)) {
> +			list_del(&wait->wq_entry.entry);

__remove_wait_queue()?

Looks good to me otherwise. Can you please cc Andrew Morton and memcg
maintainers on the next post?

Thanks.

-- 
tejun


      reply	other threads:[~2025-09-17 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 15:01 Julian Sun
2025-09-17 18:31 ` Tejun Heo [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=aMr-chVzDBfU7BvF@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=sunjunchao@bytedance.com \
    --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