linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Shakeel Butt <shakeel.butt@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] memcg: simple cleanup of stats update functions
Date: Mon, 27 May 2024 18:34:24 +0200	[thread overview]
Message-ID: <86006806-4ffc-4330-ab4b-29215ab2c98c@kernel.org> (raw)
In-Reply-To: <20240527152200.P1rU7FaG@linutronix.de>

On 5/27/24 5:22 PM, Sebastian Andrzej Siewior wrote:
> On 2024-04-20 16:25:05 [-0700], Shakeel Butt wrote:
>> mod_memcg_lruvec_state() is never called from outside of memcontrol.c
>> and with always irq disabled. So, replace it with the irq disabled
>> version and add an assert that irq is disabled in the caller.
> 
> unless PREEMPT_RT is enabled. In that case IRQs are not disabled as part
> of local_lock_irqsave(&memcg_stock.stock_lock, …) leading to:

But then the "interrupts are handled by a kernel thread that can sleep" part
of RT also means it's ok to just have the stock_lock taken with no
interrupts disabled as no actual raw interrupt handler will interrupt the
holder and deadlock, right?

> | ------------[ cut here ]------------
> | WARNING: CPU: 0 PID: 1 at mm/memcontrol.c:3150 __mod_objcg_mlstate+0xc2/0x110
> | CPU: 0 PID: 1 Comm: systemd Not tainted 6.10.0-rc1-rt0+ #17
> | Call Trace:
> |  <TASK>
> |  mod_objcg_state+0x2b3/0x320
> |  __memcg_slab_post_alloc_hook+0x13c/0x340
> |  kmem_cache_alloc_lru_noprof+0x2bd/0x2e0
> |  alloc_inode+0x59/0xc0
> |  iget_locked+0xf0/0x290
> 
> suggestions?

So in that case the appropriate thing would be to replace the assert with
lockdep_assert_held(&memcg_stock.stock_lock);
?

It seems all the code paths leading here have that one.

> Sebastian
> 



  reply	other threads:[~2024-05-27 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20 23:25 Shakeel Butt
2024-05-27 15:22 ` Sebastian Andrzej Siewior
2024-05-27 16:34   ` Vlastimil Babka (SUSE) [this message]
2024-05-28  5:16     ` Shakeel Butt
2024-05-28  7:56       ` Sebastian Andrzej Siewior
2024-05-28  8:10         ` Vlastimil Babka (SUSE)
2024-05-28 10:19           ` Sebastian Andrzej Siewior
2024-05-28 12:17             ` Vlastimil Babka (SUSE)

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=86006806-4ffc-4330-ab4b-29215ab2c98c@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tglx@linutronix.de \
    /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