All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Yejune Deng <yejune.deng@gmail.com>,
	cl@linux.com, penberg@kernel.org, rientjes@google.com,
	iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Yejune Deng <yejunedeng@gmail.com>
Subject: Re: [PATCH 2/2] mm: slub: use DEFINE_RAW_SPINLOCK init object_map_lock
Date: Tue, 25 May 2021 12:46:35 +0200	[thread overview]
Message-ID: <427f87d6-b506-a225-1887-cf8c13d99634@suse.cz> (raw)
In-Reply-To: <1621938235-11947-2-git-send-email-yejunedeng@gmail.com>

On 5/25/21 12:23 PM, Yejune Deng wrote:
> Use DEFINE_RAW_SPINLOCK instead of DEFINE_SPINLOCK object_map_lock
> that won't be preempted on mainline and PREEMPT_RT kernels.
> 
> Signed-off-by: Yejune Deng <yejunedeng@gmail.com>

RT tree also has such patch, with IMHO more thorough description:

https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/0002-mm-slub-Make-object_map_lock-a-raw_spinlock_t.patch?h=linux-5.12.y-rt-patches

I was planning to include that in the next version of my series as that
will indeed be necessary.

> ---
>  mm/slub.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index c2f63c3..995f3d0 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -445,7 +445,7 @@ static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page,
>  
>  #ifdef CONFIG_SLUB_DEBUG
>  static unsigned long object_map[BITS_TO_LONGS(MAX_OBJS_PER_PAGE)];
> -static DEFINE_SPINLOCK(object_map_lock);
> +static DEFINE_RAW_SPINLOCK(object_map_lock);
>  
>  #if IS_ENABLED(CONFIG_KUNIT)
>  static bool slab_add_kunit_errors(void)
> @@ -481,7 +481,7 @@ static unsigned long *get_map(struct kmem_cache *s, struct page *page)
>  
>  	VM_BUG_ON(!irqs_disabled());
>  
> -	spin_lock(&object_map_lock);
> +	raw_spin_lock(&object_map_lock);
>  
>  	bitmap_zero(object_map, page->objects);
>  
> @@ -494,7 +494,7 @@ static unsigned long *get_map(struct kmem_cache *s, struct page *page)
>  static void put_map(unsigned long *map) __releases(&object_map_lock)
>  {
>  	VM_BUG_ON(map != object_map);
> -	spin_unlock(&object_map_lock);
> +	raw_spin_unlock(&object_map_lock);
>  }
>  
>  static inline unsigned int size_from_object(struct kmem_cache *s)
> 


  reply	other threads:[~2021-05-25 10:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 10:23 [PATCH 1/2] mm: slab/slub: use raw_spinlock_t to define list_lock Yejune Deng
2021-05-25 10:23 ` [PATCH 2/2] mm: slub: use DEFINE_RAW_SPINLOCK init object_map_lock Yejune Deng
2021-05-25 10:46   ` Vlastimil Babka [this message]
2021-05-25 23:16     ` Andrew Morton
2021-05-25 10:43 ` [PATCH 1/2] mm: slab/slub: use raw_spinlock_t to define list_lock Vlastimil Babka

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=427f87d6-b506-a225-1887-cf8c13d99634@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=rientjes@google.com \
    --cc=tglx@linutronix.de \
    --cc=yejune.deng@gmail.com \
    --cc=yejunedeng@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.