Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2065228pxb; Fri, 25 Mar 2022 10:28:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwymPbK4VUORMTM9ftOGI/eawqrDb0/XDzQOkQ5flSCuUER6P6TztC01g8DzZKJfffRDREk X-Received: by 2002:a17:902:6b0a:b0:154:6527:8ddf with SMTP id o10-20020a1709026b0a00b0015465278ddfmr12809847plk.154.1648229286120; Fri, 25 Mar 2022 10:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648229286; cv=none; d=google.com; s=arc-20160816; b=Nyy9cTfE9/bZ24FXaNSlEKvhFjT9by4NfPvca3vUMqp5RGVRhZ0T3LlqtapwYex1xy LITAz7yGFa8S+FhVReCK53MluYboCFvokRS6b/DVdJmT6FATn67D/hNIB5fCT3kd2Wcq rlcuwNaSlNdtfur1sYaGqWDYMQh8Ziqtltz/fYq+hEy6O6bdet7VjwJc1Ph6Upi3IPQY NkOIAbSCsADfS60wWx7zjqnJr8O98IToJPkomd1qvlcchXVRpey07rAom5FwWRN75RKn aapwfylKI4jVedCC90TB8eUQcUmBt+FDkqE52J57b30AdOywjTfQ/bATuU5IKoa23EdG fcyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=eZ+osao9kQ8YgBCBxHKZy0cRJWbFLf+edwLF/UPDRl4=; b=LTHhzbwBWSKgRWHFMsptkNKmeMykDgLIObIAA1fww2KDHxBtPceDE/qYNvgIt8mj7X kNGc4BpkpEWdqA19nKfkj29oTaJwY2LGerNY3Q39PN8UxpwNAprdK1vDDsRjwXKWXBU/ W2CeBz/3usAZuz1CB1/I7ZJD31kXiETJgFAAQq62Dr9/ghNxNfH95QWBDEPJmm3UMjs8 5mfssQIkwM31wUrwH+GurDKh3NPeNfJnq9APGXByE1mCL4f4YIPccwcxA00uPXPEOgcO b3BFUt788klXv/AndYjYLAtJzkM/pcwh9wsEUZCat53/Kz4D0SzIl+z6M6oBxh69ezrZ Bh2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dE8bjG03; dkim=neutral (no key) header.i=@suse.cz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id cj12-20020a056a00298c00b004fa8517dcdbsi2970491pfb.215.2022.03.25.10.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 10:28:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dE8bjG03; dkim=neutral (no key) header.i=@suse.cz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 58641103B97; Fri, 25 Mar 2022 10:22:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243708AbiCXRia (ORCPT + 99 others); Thu, 24 Mar 2022 13:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239992AbiCXRi3 (ORCPT ); Thu, 24 Mar 2022 13:38:29 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF8FA996F for ; Thu, 24 Mar 2022 10:36:57 -0700 (PDT) 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.