Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3630574imm; Fri, 25 May 2018 08:54:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqxJYtnhGwI+jHLR8Y15Dl6JYgCrzwyKOaakGxg7oopwy6/esTkvEZF1xPUPSz9r1pZMIDL X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr3171661plq.130.1527263642030; Fri, 25 May 2018 08:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527263641; cv=none; d=google.com; s=arc-20160816; b=i2Zb7/dX/q8Ek8c75UabS4p0X07xyiLAHuRzSgtjhUY4Lj52Abc/0cvA+x7M1NG6Z1 UP0reCFFvKUAuXeEEb1zarpoToSf6+ERJIMcZAzQM/E3fhgPiHWhb1pYazJoFhwY1ZZY dGOFhxD43DHdNl6ew6kajzXiyiXzVv7eX6WYfJgGbvRaS+cLrIbMwcHTWrcwGCEHkB36 SGETBFsOdkxVxCQ5EPCVsvJi9fXt5A+E1Hdi5ZsKEvL/GdMasZ+d7DMlFTOHd6Rp6VVM t0QwbW3v+hyhWRPqp1PrEboCTqcD71nPq9VW0Suy1E5ze7JH9ji9ix2ZN3mRijN/q6gk 2mcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=oWOaJz7ic9bHiNDWdCjnJb+2Af+Hrh2eWsU2wKbcWHc=; b=C2umbfm9RVaUku9ZTphEMNmkEX/8ivwxlluOqmin7bYTXaSFn1MIZQirV3fAtgfqIV 5H5gugEX65jkh4JXsL1LlMZlDszOjWEeW0t66l2BDGEEaL+XUAqYVhww+Rvghju6DpIy ilV+ujsl1zUeOhemKZ3z0Vb1Jf8zoGKfZHzkHBtN0Zz1G8C2JL3nd+VWi8IBWF7B7iXR qMjHk3RIPWUGy+5Pl4xA/qRnHhRnllKAe4XGf9UYUUOfvr18fr4Ztbn6jsdnz8mOfylz eV3jWi5mOjOmMqIE5uq+eMlh6Svn41OhJ8F+9csHY1hAg5ibTSWXpyPMESiy9K7LBngy Virg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Yz85fTmI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si24018205pfv.135.2018.05.25.08.53.47; Fri, 25 May 2018 08:54:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Yz85fTmI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967068AbeEYPwJ (ORCPT + 99 others); Fri, 25 May 2018 11:52:09 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:52464 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966513AbeEYPv7 (ORCPT ); Fri, 25 May 2018 11:51:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1527263518; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=jkvNOTyAeaI14+GPEzKsv7fRUlRrQSE3DooBkLWM6Cg=; b=Yz85fTmIQlCiyBVMWz3tV6T1h8z56LlDAC2WibQ3aJqxaoLVtsBxqaLi11ZD7zvW Jl5WrRV7qi+eczqtIG8o/yC6kNdjgaLHi2YMT8vR1j73Q6IDdn6AIwqhiE2wke4vZyW enWUqeARxuvB8YAMRjWXjZxp5g+7uWsEUA2OH2ew= Date: Fri, 25 May 2018 15:51:57 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Vlastimil Babka cc: linux-mm@kvack.org, Roman Gushchin , Michal Hocko , Johannes Weiner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Mel Gorman , Vijayanand Jitta Subject: Re: [RFC PATCH 1/5] mm, slab/slub: introduce kmalloc-reclaimable caches In-Reply-To: <20180524110011.1940-2-vbabka@suse.cz> Message-ID: <0100016397ffdbf2-dc8a305f-efa8-4771-9f2a-3a7568693db4-000000@email.amazonses.com> References: <20180524110011.1940-1-vbabka@suse.cz> <20180524110011.1940-2-vbabka@suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.05.25-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 May 2018, Vlastimil Babka wrote: > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 9ebe659bd4a5..5bff0571b360 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -296,11 +296,16 @@ static inline void __check_heap_object(const void *ptr, unsigned long n, > (KMALLOC_MIN_SIZE) : 16) > > #ifndef CONFIG_SLOB > -extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; > +extern struct kmem_cache *kmalloc_caches[2][KMALLOC_SHIFT_HIGH + 1]; > #ifdef CONFIG_ZONE_DMA > extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; > #endif In the existing code we used a different array name for the DMA caches. This is a similar situation. I would suggest to use kmalloc_reclaimable_caches[] or make it consistent by folding the DMA caches into the array too (but then note the issues below). > @@ -536,12 +541,13 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) > #ifndef CONFIG_SLOB > if (!(flags & GFP_DMA)) { > unsigned int index = kmalloc_index(size); > + unsigned int recl = kmalloc_reclaimable(flags); This is a hotpath reserved for regular allocations. The reclaimable slabs need to be handled like the DMA slabs. So check for GFP_DMA plus the reclaimable flags. > @@ -588,12 +594,13 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) > if (__builtin_constant_p(size) && > size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) { > unsigned int i = kmalloc_index(size); > + unsigned int recl = kmalloc_reclaimable(flags); > Same situation here and additional times below.