Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748AbcDNB4K (ORCPT ); Wed, 13 Apr 2016 21:56:10 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:57123 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbcDNB4I (ORCPT ); Wed, 13 Apr 2016 21:56:08 -0400 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: iamjoonsoo.kim@lge.com X-Original-SENDERIP: 10.177.222.138 X-Original-MAILFROM: iamjoonsoo.kim@lge.com Date: Thu, 14 Apr 2016 10:56:40 +0900 From: Joonsoo Kim To: Christoph Lameter Cc: Andrew Morton , Pekka Enberg , David Rientjes , Jesper Dangaard Brouer , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 01/11] mm/slab: fix the theoretical race by holding proper lock Message-ID: <20160414015640.GB9198@js1304-P5Q-DELUXE> References: <1460436666-20462-1-git-send-email-iamjoonsoo.kim@lge.com> <1460436666-20462-2-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1043 Lines: 31 On Tue, Apr 12, 2016 at 11:38:39AM -0500, Christoph Lameter wrote: > On Tue, 12 Apr 2016, js1304@gmail.com wrote: > > > @@ -2222,6 +2241,7 @@ static void drain_cpu_caches(struct kmem_cache *cachep) > > { > > struct kmem_cache_node *n; > > int node; > > + LIST_HEAD(list); > > > > on_each_cpu(do_drain, cachep, 1); > > check_irq_on(); > > @@ -2229,8 +2249,13 @@ static void drain_cpu_caches(struct kmem_cache *cachep) > > if (n->alien) > > drain_alien_cache(cachep, n->alien); > > > > - for_each_kmem_cache_node(cachep, node, n) > > - drain_array(cachep, n, n->shared, 1, node); > > + for_each_kmem_cache_node(cachep, node, n) { > > + spin_lock_irq(&n->list_lock); > > + drain_array_locked(cachep, n->shared, node, true, &list); > > + spin_unlock_irq(&n->list_lock); > > + > > + slabs_destroy(cachep, &list); > > Can the slabs_destroy() call be moved outside of the loop? It may be > faster then? Yes, it can. But, I'd prefer to call it on each node. It would be better for cache although it would be marginal. Thanks.