linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: linux-mm@kvack.org
Subject: Re: question on memcg_stats_[un]lock in memcg code
Date: Fri, 14 Mar 2025 11:12:04 +0100	[thread overview]
Message-ID: <20250314101204.0mN33UpM@linutronix.de> (raw)
In-Reply-To: <cmvmnaosbamr3wzep6nxp5fa5ve6huy6hoerkestpuiwmjmdhu@d6eh2eicqvv2>

On 2025-03-13 18:46:53 [-0700], Shakeel Butt wrote:
> On Thu, Mar 13, 2025 at 06:11:30PM -0700, Shakeel Butt wrote:
> > Hi Sebastian,
> > 
> > The commit be3e67b54b43 ("mm/memcg: protect per-CPU counter by disabling
> > preemption on PREEMPT_RT where needed.") added memcg_stats_lock() and
> > other variants in memcontrol.c. There usage were added in
> > __mod_memcg_lruvec_state, __count_memcg_events and mem_cgroup_swapout. I
> > am wondering why __mod_memcg_state was excluded?
> > 
> 
> Basically I wanted to know if the reason was that there were no direct
> caller for __mod_memcg_state and something like the following patch is

I guess it was omitted because the only caller is mod_memcg_state()
which disables interrupts prior calling. So this is enough.

Now if you add a user then you should add the locking like in the
suggested patch.

Sebastian


      reply	other threads:[~2025-03-14 10:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14  1:11 Shakeel Butt
2025-03-14  1:46 ` Shakeel Butt
2025-03-14 10:12   ` Sebastian Andrzej Siewior [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=20250314101204.0mN33UpM@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-mm@kvack.org \
    --cc=shakeel.butt@linux.dev \
    /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