linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: 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,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH-next v3] mm/memcg: Properly handle memcg_stock access for PREEMPT_RT
Date: Wed, 15 Dec 2021 11:58:45 -0500	[thread overview]
Message-ID: <b50b7c01-c4fc-87bd-f5d9-80e6438cf670@redhat.com> (raw)
In-Reply-To: <20211215043657.ngmxlk6rgc2ysbmz@offworld>


On 12/14/21 23:36, Davidlohr Bueso wrote:
> On Tue, 14 Dec 2021, Waiman Long wrote:
>
>> @@ -2189,7 +2194,7 @@ static void drain_local_stock(struct 
>> work_struct *dummy)
>>      * drain_stock races is that we always operate on local CPU stock
>>      * here with IRQ disabled
>>      */
>> -    local_irq_save(flags);
>> +    local_lock_irqsave(&memcg_stock.lock, flags);
>>
>>     stock = this_cpu_ptr(&memcg_stock);
>>     drain_obj_stock(&stock->irq_obj);
>
> So here there is still the problem that you can end up taking sleeping 
> locks
> with irqs disabled via obj_cgroup_put() >> obj_cgroup_release() - ie: the
> percpu_ref_switch_lock and css_set_lock. It had occurred to me to promote
> the former to a raw spinlock, but doubt we can get away with the latter.

Yes, it is tricky to avoid all these. One possibility to to delay 
obj_cgroup_release() through RCU. However, this is outside the scope of 
this patch.

Cheers,
Longman



  reply	other threads:[~2021-12-15 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 14:44 [PATCH-next v3] mm/memcg: Properly handle memcg_stock access for PREEMPT_RT Waiman Long
2021-12-15  4:36 ` Davidlohr Bueso
2021-12-15 16:58   ` Waiman Long [this message]
2021-12-17 11:42 ` Sebastian Andrzej Siewior
2021-12-17 18:21   ` Sebastian Andrzej Siewior
2021-12-17 18:46   ` Waiman Long
2021-12-17 19:48     ` Sebastian Andrzej Siewior
2021-12-19 13:20 ` [mm/memcg] 3928ba024a: WARNING:possible_recursive_locking_detected kernel test robot

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=b50b7c01-c4fc-87bd-f5d9-80e6438cf670@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=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;
as well as URLs for NNTP newsgroup(s).