Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1603616iob; Fri, 29 Apr 2022 08:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGNT8YGBiQkkxN7LF7VvZyved3P3bGcGuD5VyTZxPqWOKJsamn2A0peI4H3X2z225GGkpP X-Received: by 2002:a17:902:c40b:b0:15d:1361:f0f5 with SMTP id k11-20020a170902c40b00b0015d1361f0f5mr31221plk.172.1651247220167; Fri, 29 Apr 2022 08:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651247220; cv=none; d=google.com; s=arc-20160816; b=kzrxktJsiRMEOTdGqHznqUWmpboHyGaHTKhysSDsFx7+YqavlTe8jQ6YPTCUbWWWDK O4WJZnThx4DoTOQvsWqBSYN5tFpgk6LJuD07tbcFR4yrspCu4lrH5B33OxQwlOzZRciQ tjIlSt5lt7qjCJ3g90Jv8zk9R9iEjAFW77WZSMUAv9ggKcdjf/yzF7aVQB1Yt+JpnX1Z KxtaEEJYC34ltC59Vg53bY9dLZ9ef8VY2aXy1PReMQUyDTXYUsTJSYVK6lQ4t1c/RUdy 3rvsFfJgh3jvg3tFCtpAQS9zybsBGr4oxLWJ8QVBUWSXRzxcQBQ+ZHBM/1jzAu+Hm91f 950A== 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=IbK2VEqmYvpAFl5tGkzJpb/gXsPJVD0IA8jHw9TPBBk=; b=iNm8dHwehQZEzrw1e1zoahG62siqa31/iLLMTGLCJA3jSeyvn+2Se9WzmjI1nMUcSa 8x/pZ9eW+Td+SPvfXrmQmqA6qJNAKSMsSv7RIL9SRCDIT7ZTd1EqPkIOPn364jZOzHe5 QDmGVpV8LmTyuDGFw3cDdbVZg5JHzpTfKBqVfJZVKVjgtxfkHToSPwKSLYGDGTVoKoxR Q9eiVfmLLZqTyRIH30gNmG0wa6pyHYlmNo+WN2hA9MWbyJ7dgUHqa7mrjBMSerAfuJUm /pzhWttkfOM9KIhbihe9eAamPOeg1+782SehrvWD9bGtw5RD17mXZqz9wE52ZpOJLKX8 7l9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=zb3JmXdL; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020aa790c8000000b005057a0d266asi6804815pfk.212.2022.04.29.08.46.43; Fri, 29 Apr 2022 08:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=zb3JmXdL; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377375AbiD2Ofh (ORCPT + 99 others); Fri, 29 Apr 2022 10:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377376AbiD2Odx (ORCPT ); Fri, 29 Apr 2022 10:33:53 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D71A5E97 for ; Fri, 29 Apr 2022 07:30:31 -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 A18601F892; Fri, 29 Apr 2022 14:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1651242629; 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=IbK2VEqmYvpAFl5tGkzJpb/gXsPJVD0IA8jHw9TPBBk=; b=zb3JmXdLKXZdz1SwxC3xXgYjGHX9p5y+S0k/iQ0ddBWXXwriLGxqFXaAj/HZDqWBpHvtg7 lppkHfqFouL41dY0l05RcDB5FyWCPsccPM1yLlT/1clnOgZgP3M8KKi235D4DPup8pegLP rdsrc36ZcYAHO2xiNFl6g9InqAgBuro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1651242629; 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=IbK2VEqmYvpAFl5tGkzJpb/gXsPJVD0IA8jHw9TPBBk=; b=wSCik5wU9movZ6tpuQnC+FTt9dt6fvNtbO5+a2+LMTGXrv2DvT6D+6Piy4299sC+GcxeUk ug8mqwoAP8H1KsBg== 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 7887313AE0; Fri, 29 Apr 2022 14:30:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RKVyHIX2a2JIFwAAMHmgww (envelope-from ); Fri, 29 Apr 2022 14:30:29 +0000 Message-ID: <3a12e66d-58cb-d768-7b2e-4eb239c03ee6@suse.cz> Date: Fri, 29 Apr 2022 16:30:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 18/23] mm/sl[au]b: generalize kmalloc subsystem 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-19-42.hyeyoo@gmail.com> From: Vlastimil Babka In-Reply-To: <20220414085727.643099-19-42.hyeyoo@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: > Now everything in kmalloc subsystem can be generalized. > Let's do it! > > Generalize __kmalloc_node_track_caller(), kfree(), __ksize(), > __kmalloc_node() and move them to slab_common.c. > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > --- > mm/slab.c | 94 ----------------------------------------------- > mm/slab_common.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++ > mm/slub.c | 88 -------------------------------------------- > 3 files changed, 95 insertions(+), 182 deletions(-) > > diff --git a/mm/slab.c b/mm/slab.c > index d35873da5572..fc00aca62ae3 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3527,36 +3527,6 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep, > EXPORT_SYMBOL(kmem_cache_alloc_node_trace); > #endif > > -static __always_inline void * > -__do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller) > -{ > - struct kmem_cache *cachep; > - void *ret; > - > - if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) > - return kmalloc_large_node(size, flags, node); > - cachep = kmalloc_slab(size, flags); > - if (unlikely(ZERO_OR_NULL_PTR(cachep))) > - return cachep; > - ret = kmem_cache_alloc_node_trace(cachep, flags, node, size); > - ret = kasan_kmalloc(cachep, ret, size, flags); SLAB did kasan_kmalloc() when called from __kmalloc_node_track_caller(), and will not do after this patch, until the next patch 19/23. So I would just fold it to this patch. > - > - return ret; > -} > - > -void *__kmalloc_node(size_t size, gfp_t flags, int node) > -{ > - return __do_kmalloc_node(size, flags, node, _RET_IP_); > -} > -EXPORT_SYMBOL(__kmalloc_node); > - > -void *__kmalloc_node_track_caller(size_t size, gfp_t flags, > - int node, unsigned long caller) > -{ > - return __do_kmalloc_node(size, flags, node, caller); > -} > -EXPORT_SYMBOL(__kmalloc_node_track_caller); > - > #ifdef CONFIG_PRINTK > void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) > {