From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC396C433EF for ; Thu, 24 Mar 2022 17:36:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCADA6B0071; Thu, 24 Mar 2022 13:36:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7A066B0073; Thu, 24 Mar 2022 13:36:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1AB36B0074; Thu, 24 Mar 2022 13:36:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id AF3CC6B0071 for ; Thu, 24 Mar 2022 13:36:58 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 29BBE61DDD for ; Thu, 24 Mar 2022 17:36:58 +0000 (UTC) X-FDA: 79279985316.13.11A4A72 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf02.hostedemail.com (Postfix) with ESMTP id 06C878000B for ; Thu, 24 Mar 2022 17:36:56 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B468B1F38D; Thu, 24 Mar 2022 17:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1648143415; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eZ+osao9kQ8YgBCBxHKZy0cRJWbFLf+edwLF/UPDRl4=; b=dE8bjG03OZ633klntJoYmdbH4LvEPQCMkxYLJG3vjW3J43m1LVqf9MJxUrQWSsM2U8WkPv XrHa3gZ1rfdp2oE+msiZP7G90t3spRLyKIwIgbPIbqgT54wuRISKbN5rZE1ejuLrecubV9 Vgy47tAzo9GpFLY8+BiBRePxmdRquxQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1648143415; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eZ+osao9kQ8YgBCBxHKZy0cRJWbFLf+edwLF/UPDRl4=; b=h1a9tOzxrVkQF2BZ/+zFHQ2qnslcBAkIhDhyaa8CQh2tJMON+2SFohj2FiA1NInRqy4tYK TQbb7FYLZ8WXBXBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8FF7513A7F; Thu, 24 Mar 2022 17:36:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id atyfIjesPGLiXgAAMHmgww (envelope-from ); Thu, 24 Mar 2022 17:36:55 +0000 Message-ID: Date: Thu, 24 Mar 2022 18:36:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v1 07/15] mm/sl[au]b: kmalloc_node: pass large requests to page allocator Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Marco Elver , Matthew WilCox , Roman Gushchin , linux-kernel@vger.kernel.org References: <20220308114142.1744229-1-42.hyeyoo@gmail.com> <20220308114142.1744229-8-42.hyeyoo@gmail.com> From: Vlastimil Babka In-Reply-To: <20220308114142.1744229-8-42.hyeyoo@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: 6tiqyw6bzzpka9nmidtthdu67dn9g4t8 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 06C878000B Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=dE8bjG03; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=h1a9tOzx; dmarc=none; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspam-User: X-HE-Tag: 1648143416-175965 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 3/8/22 12:41, Hyeonggon Yoo wrote: > Now that kmalloc_large_node() is in common code, pass large requests > to page allocator in kmalloc_node() using kmalloc_large_node(). > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka > --- > include/linux/slab.h | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 8840b2d55567..33d4260bce8b 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -551,23 +551,35 @@ static __always_inline __alloc_size(1) void *kmalloc(size_t size, gfp_t flags) > return __kmalloc(size, flags); > } > > +#ifndef CONFIG_SLOB > static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t flags, int node) > { > -#ifndef CONFIG_SLOB > - if (__builtin_constant_p(size) && > - size <= KMALLOC_MAX_CACHE_SIZE) { > - unsigned int i = kmalloc_index(size); > + if (__builtin_constant_p(size)) { > + unsigned int index; > > - if (!i) > + if (size > KMALLOC_MAX_CACHE_SIZE) > + return kmalloc_large_node(size, flags, node); > + > + index = kmalloc_index(size); > + > + if (!index) > return ZERO_SIZE_PTR; > > return kmem_cache_alloc_node_trace( > kmalloc_caches[kmalloc_type(flags)][i], > flags, node, size); > } > -#endif > return __kmalloc_node(size, flags, node); > } > +#else > +static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t flags, int node) > +{ > + if (__builtin_constant_p(size) && size > KMALLOC_MAX_CACHE_SIZE) > + return kmalloc_large_node(size, flags, node); > + > + return __kmalloc_node(size, flags, node); > +} > +#endif > > /** > * kmalloc_array - allocate memory for an array.