The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Qi Zheng <qi.zheng@linux.dev>
Cc: Harry Yoo <harry@kernel.org>, Usama Arif <usama.arif@linux.dev>,
	akpm@linux-foundation.org, david@kernel.org, kasong@tencent.com,
	shakeel.butt@linux.dev, baohua@kernel.org,
	axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
	muchun.song@linux.dev, peiyang_he@smail.nju.edu.cn,
	mhocko@kernel.org, roman.gushchin@linux.dev, ljs@kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v4] mm: mglru: fix stale batch updates after memcg reparenting
Date: Fri, 10 Jul 2026 07:50:09 -0400	[thread overview]
Message-ID: <alDccVjPeCi_PN-9@cmpxchg.org> (raw)
In-Reply-To: <843f6d0d-e893-43ef-9cb3-1df21fb64b8d@linux.dev>

On Fri, Jul 10, 2026 at 02:19:15PM +0800, Qi Zheng wrote:
> On 7/10/26 9:51 AM, Johannes Weiner wrote:
> > On Thu, Jul 02, 2026 at 09:38:41AM +0800, Qi Zheng wrote:
> >> On 7/1/26 11:59 PM, Johannes Weiner wrote:
> >>> lruvec_live_lock_irq()?
> >>
> >> But lruvec_lock_irq() grabs the rcu lock too. :(
> > 
> > Yes, but it's self-explanatory if you put it with those definitions:
> > 
> > static inline void lruvec_lock_irq(struct lruvec *lruvec)
> > {
> >          rcu_read_lock();
> >          spin_lock_irq(&lruvec->lru_lock);
> > }
> > 
> > static struct lruvec *lruvec_live_lock_irq(struct lruvec *lruvec)
> > {
> > 	struct mem_cgroup *memcg = lruvec_memcg(lruvec);
> > 
> > 	rcu_read_lock();
> > 	while (unlikely(memcg && css_is_dying(&memcg->css))) {
> > 		memcg = parent_mem_cgroup(memcg);
> > 		lruvec = mem_cgroup_lruvec(memcg, lruvec_pgdat(lruvec));
> > 	}
> > 	spin_lock_irq(&lruvec->lru_lock);
> > }
> 
> All right, should the implementation for !CONFIG_MEMCG be placed here
> too?

Yes. You can just #ifdef, #else the function body itself.

static struct lruvec *lruvec_live_lock_irq()
{
#ifdef CONFIG_MEMCG
	...
#else
	lruvec_lock_irq(lruvec);
	return lruvec;
#endif
}

> Will send the v5.

Thanks.

  reply	other threads:[~2026-07-10 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  7:52 [PATCH v4] mm: mglru: fix stale batch updates after memcg reparenting Qi Zheng
2026-07-01 14:57 ` Usama Arif
2026-07-01 15:36   ` Harry Yoo
2026-07-01 15:59     ` Johannes Weiner
2026-07-02  1:38       ` Qi Zheng
2026-07-10  1:51         ` Johannes Weiner
2026-07-10  6:19           ` Qi Zheng
2026-07-10 11:50             ` Johannes Weiner [this message]
2026-07-09  4:17 ` Qi Zheng

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=alDccVjPeCi_PN-9@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=david@kernel.org \
    --cc=harry@kernel.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=peiyang_he@smail.nju.edu.cn \
    --cc=qi.zheng@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=zhengqi.arch@bytedance.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