Re: [PATCH] mm/slub: Run free_partial() outside of the kmem_cache_node->list_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 09, 2016 at 03:46:32PM +0100, Chris Wilson wrote:
...
> diff --git a/mm/slub.c b/mm/slub.c
> index 850737bdfbd8..22b2c1f3db0e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3629,11 +3629,15 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
>   */
>  static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
>  {
> +	LIST_HEAD(partial_list);
>  	struct page *page, *h;
>  
>  	BUG_ON(irqs_disabled());
>  	spin_lock_irq(&n->list_lock);
> -	list_for_each_entry_safe(page, h, &n->partial, lru) {
> +	list_splice_init(&n->partial, &partial_list);
> +	spin_unlock_irq(&n->list_lock);
> +
> +	list_for_each_entry_safe(page, h, &partial_list, lru) {
>  		if (!page->inuse) {
>  			remove_partial(n, page);

remove_partial() must be called with n->list_lock held - it even has
lockdep_assert_held(). What you actually need to do is to move
discard_slab() out of the critical section, like __kmem_cache_shrink()
does.

>  			discard_slab(s, page);
> @@ -3642,7 +3646,6 @@ static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
>  			"Objects remaining in %s on __kmem_cache_shutdown()");
>  		}
>  	}
> -	spin_unlock_irq(&n->list_lock);
>  }
>  
>  /*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]