From: Waiman Long <longman@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
linux-mm@kvack.org, Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH-next v2] mm/memcg: Properly handle memcg_stock access for PREEMPT_RT
Date: Fri, 10 Dec 2021 11:37:20 -0500 [thread overview]
Message-ID: <14de3f92-c1f8-e51e-0cd2-5ec9fc86d1c0@redhat.com> (raw)
In-Reply-To: <YbOBmYrInQVI+VOR@linutronix.de>
On 12/10/21 11:34, Sebastian Andrzej Siewior wrote:
> On 2021-12-10 11:29:31 [-0500], Waiman Long wrote:
>> On 12/10/21 08:01, Sebastian Andrzej Siewior wrote:
>>> On 2021-12-09 21:52:28 [-0500], Waiman Long wrote:
>>> …
>>>> --- a/mm/memcontrol.c
>>>> +++ b/mm/memcontrol.c
>>> …
>>>> @@ -2210,7 +2211,7 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages)
>>>> struct memcg_stock_pcp *stock;
>>>> unsigned long flags;
>>>> - local_irq_save(flags);
>>>> + local_lock_irqsave(&memcg_stock.lock, flags);
>>> Why is this one using the lock? It isn't accessing irq_obj, right?
>> Well, the lock isn't just for irq_obj. It protects the whole memcg_stock
>> structure which include irq_obj. Sometimes, data in irq_obj (or task_obj)
>> will get transfer to nr_pages and vice versa. So it is easier to use one
>> single lock for the whole thing.
> This needs way better documentation what protects what any why.
> I don't like the quick slapping for RT only usage without any kind of
> explanation. Once you think you know it is irq_obj only you end up here
> where you have the lock again for no obvious reason.
Sure, I will update the patch description and add comments to document
that. Let's see what other feedback I have before I make the update.
Cheers,
Longman
prev parent reply other threads:[~2021-12-10 16:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 2:52 Waiman Long
2021-12-10 13:01 ` Sebastian Andrzej Siewior
2021-12-10 16:29 ` Waiman Long
2021-12-10 16:34 ` Sebastian Andrzej Siewior
2021-12-10 16:37 ` Waiman Long [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=14de3f92-c1f8-e51e-0cd2-5ec9fc86d1c0@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vdavydov.dev@gmail.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