Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4436998ioa; Wed, 27 Apr 2022 04:00:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb3aSJOhmWQp9fBI8aqlov0xrLlkRQnrTFEXslyrYzhO/oxZO10ym3qufYRJr9L/+wYNX+ X-Received: by 2002:a17:902:ea57:b0:15a:6173:87dd with SMTP id r23-20020a170902ea5700b0015a617387ddmr28630295plg.147.1651057210391; Wed, 27 Apr 2022 04:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651057210; cv=none; d=google.com; s=arc-20160816; b=m5/yeVyqSZ4FImtvEH2K151KLlYmDxesxAvCWvZkUZbbazfT5JZdyojss9YR1gHTdU z3JiA3rVRGGvlbjlli3iKky+v3+r+3OwMzl/HBHF2IvqPiOSEq40EBqA8VQqJ6YZRkYo GpuCfANRHvOc4l4TCOn4Gb9tFEN1cDo9lbSLoRxwj7kqQQ+tM6XvsrwDMOU8bKWRLnhk /VhpWd57cWj1h4oGj7Zxdajnq4FmHycVPAUBOrrYuNh9rlKIkX3wox9Wyx5cliRAhwgQ 9cMSG3L0RIrdjfYRx6bPpnDZQDrscKME8eNkRVG91qiy8imL1ShFMPLzsMr9mMZeTd+W 56JA== 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=XlBpaGo31htw44cELqk1nP5QrpL931cVvjwPWxcqiIw=; b=duGjZAHtgWp2I8q3xHDFCU+htmylIIcbQMGlhqV6dh6y00eYU+XUK1o6Zipq9qdM0b Kf3MYR4Kuvu5zeHX84EmfHsbzghd2MJa0W34CRNG7FkffnN8Kv5QqDlWVuCiRLLc/Crl jr+hZQE8hMGcPskhtvkD+uP5ZkUSIlsfJo+BIv/ae+61ZFYVVTF4OzF7+meXg6PB9JUN sDDAXAY4Ef2orZ20ed4HTLpaTS/9tzL3UnJvr8Nq+PcJS3uqOnCVdj+Cd+IeJMbHITO5 e5WZW97Zw0ZoZSIzCJ1CdpsmIwluB7BbKOtyDkRZM+0wEEOFimHxx7oLF0fZpMW97Gh5 yBGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=G0brHfDR; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=FUGUeiFn; 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 g15-20020a056a0023cf00b0050d3c71a70bsi1179159pfc.375.2022.04.27.04.00.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:00:10 -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=G0brHfDR; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=FUGUeiFn; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C891F44ED00; Wed, 27 Apr 2022 03:08:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347971AbiDZQMd (ORCPT + 99 others); Tue, 26 Apr 2022 12:12:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234448AbiDZQM3 (ORCPT ); Tue, 26 Apr 2022 12:12:29 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3910173048 for ; Tue, 26 Apr 2022 09:09:20 -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-out1.suse.de (Postfix) with ESMTPS id A1AE2210E8; Tue, 26 Apr 2022 16:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1650989359; 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=XlBpaGo31htw44cELqk1nP5QrpL931cVvjwPWxcqiIw=; b=G0brHfDRp6/jozN4ch+TnhvQI1d60GJSxBhIqRPxgOLC1L9J+jWsBXcVNqcCmk8L9G4Rjn UzgQKBOfnnXPsNHq3zLgQvNa6QzhArgHNzQmrB7sx7V3lOvNMdejbgEfmaqc2NUphgOAQH Ddl0+68F3V6Kh3Vj2V0YCBWa1MQ006Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1650989359; 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=XlBpaGo31htw44cELqk1nP5QrpL931cVvjwPWxcqiIw=; b=FUGUeiFnNOxUf8Nz3Wc9EqAAULhQFZ7VGNudwHF/sq6n5RKR5hdMdonCQz9zksWktJS74u g9UUiE6li98EhPCA== 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 772D413223; Tue, 26 Apr 2022 16:09:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pyZ9HC8ZaGLeeAAAMHmgww (envelope-from ); Tue, 26 Apr 2022 16:09:19 +0000 Message-ID: <4c85b7b4-e2b3-79b0-f5c1-ae318b856750@suse.cz> Date: Tue, 26 Apr 2022 18:09:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2 06/23] mm/sl[auo]b: fold kmalloc_order_trace() into kmalloc_large() Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Marco Elver , Matthew WilCox , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220414085727.643099-1-42.hyeyoo@gmail.com> <20220414085727.643099-7-42.hyeyoo@gmail.com> From: Vlastimil Babka In-Reply-To: <20220414085727.643099-7-42.hyeyoo@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 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 autolearn=unavailable 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 4/14/22 10:57, Hyeonggon Yoo wrote: > There is no caller of kmalloc_order_trace() except kmalloc_large(). > Fold it into kmalloc_large() and remove kmalloc_order{,_trace}(). > > Also add tracepoint in kmalloc_large() that was previously > in kmalloc_order_trace(). > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > Reviewed-by: Vlastimil Babka > --- > Changes from v1: > - updated some changelog (kmalloc_order() -> kmalloc_order_trace()) > > include/linux/slab.h | 22 ++-------------------- > mm/slab_common.c | 14 +++----------- > 2 files changed, 5 insertions(+), 31 deletions(-) > > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 4c06d15f731c..6f6e22959b39 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -484,26 +484,8 @@ static __always_inline void *kmem_cache_alloc_node_trace(struct kmem_cache *s, g > } > #endif /* CONFIG_TRACING */ > > -extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) __assume_page_alignment > - __alloc_size(1); > - > -#ifdef CONFIG_TRACING > -extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) > - __assume_page_alignment __alloc_size(1); > -#else > -static __always_inline __alloc_size(1) void *kmalloc_order_trace(size_t size, gfp_t flags, > - unsigned int order) > -{ > - return kmalloc_order(size, flags, order); > -} > -#endif > - > -static __always_inline __alloc_size(1) void *kmalloc_large(size_t size, gfp_t flags) > -{ > - unsigned int order = get_order(size); > - return kmalloc_order_trace(size, flags, order); > -} > - > +extern void *kmalloc_large(size_t size, gfp_t flags) __assume_page_alignment > + __alloc_size(1); I missed this extern in v1, please drop. > /** > * kmalloc - allocate memory > * @size: how many bytes of memory are required. > diff --git a/mm/slab_common.c b/mm/slab_common.c > index c4d63f2c78b8..308cd5449285 100644 > --- a/mm/slab_common.c > +++ b/mm/slab_common.c > @@ -925,10 +925,11 @@ gfp_t kmalloc_fix_flags(gfp_t flags) > * directly to the page allocator. We use __GFP_COMP, because we will need to > * know the allocation order to free the pages properly in kfree. > */ > -void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) > +void *kmalloc_large(size_t size, gfp_t flags) > { > void *ret = NULL; > struct page *page; > + unsigned int order = get_order(size); > > if (unlikely(flags & GFP_SLAB_BUG_MASK)) > flags = kmalloc_fix_flags(flags); > @@ -943,19 +944,10 @@ void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) > ret = kasan_kmalloc_large(ret, size, flags); > /* As ret might get tagged, call kmemleak hook after KASAN. */ > kmemleak_alloc(ret, size, 1, flags); > - return ret; > -} > -EXPORT_SYMBOL(kmalloc_order); > - > -#ifdef CONFIG_TRACING > -void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) > -{ > - void *ret = kmalloc_order(size, flags, order); > trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags); > return ret; > } > -EXPORT_SYMBOL(kmalloc_order_trace); > -#endif > +EXPORT_SYMBOL(kmalloc_large); > > #ifdef CONFIG_SLAB_FREELIST_RANDOM > /* Randomize a generic freelist */