Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp13310458rwb; Sun, 27 Nov 2022 03:44:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf4V9fhf+zyOEjP9NOANUuxr+asUze0K30SAvLKzSKAOELfbJo0+8U28GG88rvsAvl+ucmnr X-Received: by 2002:a05:6a00:35cd:b0:573:787c:c7a4 with SMTP id dc13-20020a056a0035cd00b00573787cc7a4mr37094705pfb.37.1669549446269; Sun, 27 Nov 2022 03:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669549446; cv=none; d=google.com; s=arc-20160816; b=DpMQqyAVzNGltS3otJ93w1C3eJRpBlIxLKkZLBXB2Pb2rL8T9pkgfdEy5QmO7rKNjk TuoLnzPkux9z2DcYv32j85lNJHF+sCXhA1HrbBw+MJCIF5/KEJ0nZDrKqYwoV3xDp7W7 Nm04noF5Tjf8Z5EToC5c6dtrZEHC1/jC/KAedOmWzgfKNGB/Un1EdXhWnm5kjv+TKWU+ TKSHUJE+5U7PiER9TEXvaPao08pyUb8pfvn4qzjfcpfM4UOGrsZK71G/BcEeeX6Ercag gg6194woFwkKHjwEuhxWkfbQ/JGaA/4inKJZGtxy8xIndkVIahS3T34UhgTNOluxgSxU 1lkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kaGLCyXdBMIaKuINsSow+H91A2R/a1Mjh2wpGhwGfqc=; b=B7j23tZLD0hV6/3dEhOqRIOjJguBt+Ul1wJgr0+zPY4WkMiiVAvxzigms1qeWmRhOr JbnWiszccxUlf7+Pp8diRwfhINXlAeGrwRnqgzChzGMhC9lT9yOoY5LYTlchIVYVzp1v z8aCr9u7jSyWrgSR3huFTUt4IuJdXzOKUJs6z+zvkxo+qsNNeBgpRojd3+tZ3QCKp9R+ 65+QpD9gDAKMKJXSZOvIghmsY6Ew3tUVFshdo3EdEdq34xwmhn5bA0MBrqfusBe0STg8 JFpjCl+v1PcAVMoNYJirvJ0QFdQtogoY90FtSJn8kb7VtJSbD+52sjlFWo4oo1zy1AH+ DAbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lr3b8t+b; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a056a0015cc00b0057509d0411esi2557338pfu.192.2022.11.27.03.43.55; Sun, 27 Nov 2022 03:44:06 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=Lr3b8t+b; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbiK0Kyl (ORCPT + 84 others); Sun, 27 Nov 2022 05:54:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiK0Kyj (ORCPT ); Sun, 27 Nov 2022 05:54:39 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B097655 for ; Sun, 27 Nov 2022 02:54:38 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso11421010pjt.0 for ; Sun, 27 Nov 2022 02:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kaGLCyXdBMIaKuINsSow+H91A2R/a1Mjh2wpGhwGfqc=; b=Lr3b8t+b+nSA4PI/Pfz5w8RtWZ0CYsK0Qx+29vlI65Y9TzCMP4rmS7qnx69Ohy0cMk n9P6TQiWiDHSrKXfRdHwhWUw8mAk2vSPJqDpViCtxZ6njrYzkNDw63j60++ACy1efjEa 0mRS6RGREsTNjaEo/PKxwQFjwLoYt+r3kZa1DzUKUssPkr5QgqvaK28TS0xcYf0PuUab jbQTeSLjuOUW8NudOa/XT61TzHp2T/IK8zp+3baM4Sj2ZS5dNpODOSOcK+cHgIsPlJTk LQb0LVwmbNlaQ405kK5SLpisHMo5V5mmXAfPRf6SiWFLF4k3SeWzNmWIUoVtdIgXXRTB NPug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kaGLCyXdBMIaKuINsSow+H91A2R/a1Mjh2wpGhwGfqc=; b=nq4eCi4Xkp855BHeCfqIO7CtLOzegfYij0xD0yiImAOI8BpFodrcnFdnTBSZK065cV ZKFGaiSmNtt9G0V8AxnFfIpHj2KgZeKC6gs82ICru92JzRFEqdpMUgGgLT4pXlFMq90M eE+ogaOtyWBtiL+n3xPL6o6+CMR07nYbB5ZYzAhSU1SxMG5dBaH7h+t4W8JiiQ2/BGJG mshRfSeTDQhoOi/aeNnvTdDNZ2sOaxePMDrV6QiG7spufwkGEBFng1LlgnV59x83ZLYQ rgw5yrr05MiK0m0e5pjEdWZ0aOMoINqGIygOnoL5YJyZ81ZY4E/PbQ4LTiJ2xHQT2qP8 UM3w== X-Gm-Message-State: ANoB5plxJ7IBK/SnCoYVs1kxHQa60/jgaIOis6prDLENSoTxXZgLcp3Z QIXcpXr0Hx4rfNdY9k99ILA= X-Received: by 2002:a17:90a:eac2:b0:219:484:e955 with SMTP id ev2-20020a17090aeac200b002190484e955mr13854997pjb.214.1669546477967; Sun, 27 Nov 2022 02:54:37 -0800 (PST) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id s33-20020a63ff61000000b004772abe41f6sm5071054pgk.83.2022.11.27.02.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 02:54:36 -0800 (PST) Date: Sun, 27 Nov 2022 19:54:30 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , Roman Gushchin , Andrew Morton , Linus Torvalds , Matthew Wilcox , patches@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/12] mm, slub: split out allocations from pre/post hooks Message-ID: References: <20221121171202.22080-1-vbabka@suse.cz> <20221121171202.22080-10-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221121171202.22080-10-vbabka@suse.cz> X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Mon, Nov 21, 2022 at 06:11:59PM +0100, Vlastimil Babka wrote: > In the following patch we want to introduce CONFIG_SLUB_TINY allocation > paths that don't use the percpu slab. To prepare, refactor the > allocation functions: > > Split out __slab_alloc_node() from slab_alloc_node() where the former > does the actual allocation and the latter calls the pre/post hooks. > > Analogically, split out __kmem_cache_alloc_bulk() from > kmem_cache_alloc_bulk(). > > Signed-off-by: Vlastimil Babka > --- > mm/slub.c | 127 +++++++++++++++++++++++++++++++++--------------------- > 1 file changed, 77 insertions(+), 50 deletions(-) [...] > + > +/* Note that interrupts must be enabled when calling this function. */ > +int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, > + void **p) > +{ > + int i; > + struct obj_cgroup *objcg = NULL; > + > + /* memcg and kmem_cache debug support */ > + s = slab_pre_alloc_hook(s, NULL, &objcg, size, flags); > + if (unlikely(!s)) > + return false; > + > + i = __kmem_cache_alloc_bulk(s, flags, size, p, objcg); > + > + /* > + * memcg and kmem_cache debug support and memory initialization. > + * Done outside of the IRQ disabled fastpath loop. > + */ > + if (i != 0) > + slab_post_alloc_hook(s, objcg, flags, size, p, > + slab_want_init_on_alloc(flags, s)); This patch looks mostly good but wondering what happens if someone calls it with size == 0 so it does not call slab_post_alloc_hook()? > + return i; > } > EXPORT_SYMBOL(kmem_cache_alloc_bulk); > > -- > 2.38.1 > -- Thanks, Hyeonggon