Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbbBQQDz (ORCPT ); Tue, 17 Feb 2015 11:03:55 -0500 Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:56479 "EHLO resqmta-po-05v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071AbbBQQDx (ORCPT ); Tue, 17 Feb 2015 11:03:53 -0500 Date: Tue, 17 Feb 2015 10:03:51 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: Joonsoo Kim cc: David Rientjes , akpm@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, penberg@kernel.org, iamjoonsoo@lge.com, Jesper Dangaard Brouer Subject: Re: [PATCH 1/3] Slab infrastructure for array operations In-Reply-To: <20150217051541.GA15413@js1304-P5Q-DELUXE> Message-ID: References: <20150210194804.288708936@linux.com> <20150210194811.787556326@linux.com> <20150213023534.GA6592@js1304-P5Q-DELUXE> <20150217051541.GA15413@js1304-P5Q-DELUXE> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2248 Lines: 47 On Tue, 17 Feb 2015, Joonsoo Kim wrote: > Hmm...so far, SLAB focus on temporal locality rather than spatial locality > as you know. Why SLAB need to consider spatial locality first in this > kmem_cache_alloc_array() case? Well we are talking about a large number of objects. And going around randomly in memory is going to cause a lot of TLB misses. Spatial locality increases the effectiveness of the processing of these objects. > And, although we use partial list first, we can't reduce > fragmentation as much as SLUB. Local cache may keep some free objects > of the partial slab so just exhausting free objects of partial slab doesn't > means that there is no free object left. For SLUB, exhausting free > objects of partial slab means there is no free object left. SLUB will still have the per cpu objects in the per cpu page and te per cpu slab pages. > If we allocate objects from local cache as much as possible, we can > keep temporal locality and return objects as fast as possible since > returing objects from local cache just needs memcpy from local array > cache to destination array. I thought the point was that this is used to allocate very large amounts of objects. The hotness is not that big of an issue. > As David said, there is no implementation for SLAB yet and we have > different opinion about implementation for SLAB. It's better > to delay detailed implementation of kmem_cache_alloc_array() > until implementation for SLAB is agreed. Before it, calling > __kmem_cache_alloc_array() in kmem_cache_alloc_array() is sufficient > to provide functionality. Its not that detailed. It is just layin out the basic strategy for the array allocs. First go to the partial lists to decrease fragmentation. Then bypass the allocator layers completely and go direct to the page allocator if all objects that the page will accomodate can be put into the array. Lastly use the cpu hot objects to fill in the leftover (which would in any case be less than the objects in a page). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/