linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Pekka Enberg <penberg@kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH 1/9] slub: Make PREEMPT_RT support less convoluted
Date: Wed, 24 Aug 2022 15:54:54 +0200	[thread overview]
Message-ID: <e3f9bde2-7754-491a-78c0-a4a37dacbdd5@suse.cz> (raw)
In-Reply-To: <YwYm31FKQJh/CVBn@linutronix.de>

On 8/24/22 15:25, Sebastian Andrzej Siewior wrote:
> On 2022-08-23 19:15:43 [+0200], Vlastimil Babka wrote:
>>> +#define slub_local_irq_save(flags)	local_irq_save(flags)
>>> +#define slub_local_irq_restore(flags)	local_irq_restore(flags)
>>
>> Note these won't be neccessary anymore after
>> https://lore.kernel.org/linux-mm/20220823170400.26546-6-vbabka@suse.cz/T/#u
> 
> Okay, let me postpone that one and rebase what is left on top.
> 
>>> @@ -482,7 +488,7 @@ static inline bool __cmpxchg_double_slab(struct kmem_cache *s, struct slab *slab
>>>   		void *freelist_new, unsigned long counters_new,
>>>   		const char *n)
>>>   {
>>> -	if (!IS_ENABLED(CONFIG_PREEMPT_RT))
>>> +	if (use_lockless_fast_path())
>>>   		lockdep_assert_irqs_disabled();
>>
>> This test would stay after the patch I referenced above. But while this
>> change will keep testing the technically correct thing, the name would be
>> IMHO misleading here, as this is semantically not about the lockless fast
>> path, but whether we need to have irqs disabled to avoid a deadlock due to
>> irq incoming when we hold the bit_spin_lock() and its handler trying to
>> acquire it as well.
> 
> Color me confused. Memory is never allocated in-IRQ context on
> PREEMPT_RT. Therefore I don't understand why interrupts must be disabled
> for the fast path (unless that comment only applied to !RT).

Yes that only applied to !RT. Hence why the assert is there only for !RT.

> It could be about preemption since spinlock, local_lock don't disable
> preemption and so another allocation on the same CPU is possible. But
> then you say "we hold the bit_spin_lock()" and this one disables
> preemption. This means nothing can stop the bit_spin_lock() owner from
> making progress and since there is no memory allocation in-IRQ, we can't
> block on the same bit_spin_lock() on the same CPU.

Yeah, realizing that this is true on RT led to the recent patch I 
referenced. Initially when converting SLUB to RT last year I didn't 
realize this detail, and instead replaced the irq disabling done (only 
on !RT) by e.g. local_lock_irqsave with the manual local_irq_save().

> Sebastian



  reply	other threads:[~2022-08-24 13:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220817162703.728679-1-bigeasy@linutronix.de>
2022-08-17 16:26 ` Sebastian Andrzej Siewior
2022-08-18  9:42   ` Christoph Lameter
2022-08-18 14:37     ` Vlastimil Babka
2022-08-18 15:22       ` Sebastian Andrzej Siewior
2022-08-19 15:04       ` Christoph Lameter
2022-08-25  5:15         ` Hyeonggon Yoo
2022-08-18 17:34   ` Linus Torvalds
2022-08-23 17:15   ` Vlastimil Babka
2022-08-24 13:25     ` Sebastian Andrzej Siewior
2022-08-24 13:54       ` Vlastimil Babka [this message]
2022-08-24 13:57         ` Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 4/9] mm/vmstat: Use preempt_[dis|en]able_nested() Sebastian Andrzej Siewior
2022-08-17 16:26 ` [PATCH 5/9] mm/debug: Provide VM_WARN_ON_IRQS_ENABLED() Sebastian Andrzej Siewior
2022-08-17 16:27 ` [PATCH 6/9] mm/memcontrol: Replace the PREEMPT_RT conditionals Sebastian Andrzej Siewior
2022-08-17 16:59   ` Johannes Weiner
2022-08-18  2:45   ` Muchun Song
2022-08-17 16:27 ` [PATCH 7/9] mm/compaction: Get rid of RT ifdeffery Sebastian Andrzej Siewior
2022-08-18  8:55   ` Rasmus Villemoes
2022-08-18 15:51     ` Sebastian Andrzej Siewior
2022-08-24 13:50     ` Thomas Gleixner

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=e3f9bde2-7754-491a-78c0-a4a37dacbdd5@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    /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