Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1353145

Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic

From Vlastimil Babka <vbabka@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic
Date 2016-03-08 16:40 +0100
Message-ID <rarTP-2Ho-1@gated-at.bofh.it> (permalink)
References <raqXM-25J-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/08/2016 03:30 PM, Vineet Gupta wrote:
> We observed livelocks on ARC SMP setup when running hackbench with SLUB.
> This hardware configuration lacks atomic instructions (LLOCK/SCOND) thus
> kernel resorts to a central @smp_bitops_lock to protect any R-M-W ops
> suh as test_and_set_bit()

Sounds like this architecture should then redefine __clear_bit_unlock
and perhaps other non-atomic __X_bit() variants to be atomic, and not
defer this requirement to places that use the API?

> The spinlock itself is implemented using Atomic [EX]change instruction
> which is always available.
> 
> The race happened when both cores tried to slab_lock() the same page.
> 
>    c1		    c0
> -----------	-----------
> slab_lock
> 		slab_lock
> slab_unlock
> 		Not observing the unlock
> 
> This in turn happened because slab_unlock() doesn't serialize properly
> (doesn't use atomic clear) with a concurrent running
> slab_lock()->test_and_set_bit()
> 
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Noam Camus <noamc@ezchip.com>
> Cc: <stable@vger.kernel.org>
> Cc: <linux-mm@kvack.org>
> Cc: <linux-kernel@vger.kernel.org>
> Cc: <linux-snps-arc@lists.infradead.org>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index d8fbd4a6ed59..b7d345a508dc 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -345,7 +345,7 @@ static __always_inline void slab_lock(struct page *page)
>  static __always_inline void slab_unlock(struct page *page)
>  {
>  	VM_BUG_ON_PAGE(PageTail(page), page);
> -	__bit_spin_unlock(PG_locked, &page->flags);
> +	bit_spin_unlock(PG_locked, &page->flags);
>  }
>  
>  static inline void set_page_slub_counters(struct page *page, unsigned long counters_new)
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-08 15:40 +0100
  Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Christoph Lameter <cl@linux.com> - 2016-03-08 16:10 +0100
    Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <vgupta@synopsys.com> - 2016-03-08 16:50 +0100
      Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Christoph Lameter <cl@linux.com> - 2016-03-08 21:50 +0100
        Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-09 07:50 +0100
          Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-09 11:20 +0100
            Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-09 11:40 +0100
              Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-09 12:20 +0100
            Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-09 12:10 +0100
              Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-09 12:50 +0100
                Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-09 13:00 +0100
                Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-09 13:30 +0100
                Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-14 09:10 +0100
            Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-09 14:30 +0100
              Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-09 16:00 +0100
                Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-03-10 07:00 +0100
                Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Peter Zijlstra <peterz@infradead.org> - 2016-03-10 10:20 +0100
  Re: [PATCH] mm: slub: Ensure that slab_unlock() is atomic Vlastimil Babka <vbabka@suse.cz> - 2016-03-08 16:40 +0100

csiph-web