Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7030015rwi; Mon, 24 Oct 2022 09:00:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pw5KRrpz1bnlm07f//23dfQpL1+32cVgVYqFoldRILoHS/QL0TMSDhM7TyiFNPtpOAov8 X-Received: by 2002:a05:6402:909:b0:435:a8b:5232 with SMTP id g9-20020a056402090900b004350a8b5232mr31304819edz.240.1666627244002; Mon, 24 Oct 2022 09:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627243; cv=none; d=google.com; s=arc-20160816; b=ORS4JN0kHTA41t0cSKiyhpEq3UTI4kWaTy7WFn8o7yZFfWxF7d45G0cwLiEqnV4kB1 36UV73hFkOFk+FkwBT8WOsTLdEutMUSGwuD1HBAjogv7qQQYNSxngeCOoJZ9k1Lz5jXM vD36oXORBQOcg9PZNgKOB1SJmY8B2m3S61+b7a8EVhwKKgwIxA6NnypHWxByUJjw3TXa DgdEQ6LtenqEIp5ouac4imEJ8MA191QpDKtz2vw2i/qoTb32qxFjND+RIMsZAcipgj9t 2D7R9XcbpPXrtXGMq22gWUHlDe4nADl33iKswLIZcbOc9NX4UfPsoN8J+5Ak9Xq11ps5 goCA== 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=71eY0kkxWRwBjV2G3scfnzcrcRhO3rXFbeUg0pv3GQg=; b=SGjtrwJ8yj4j1wUmvsigG5wNma58FkAAKpo/Mhoy6UcdGfVS1aQfU8+8wolfF1l6Fm vY2+Ph1ZIJza0asD/nccYDdJWPvm7c/z5GFFXqbKjgBC+S08LXF5J/vonlqqkiE4udnj 8IrrthJVkTXOEv9mY3vcKMhRbITAcNy/LGIcFTLm37LhHc0NtG8VMLnPx2s0rAataMvp ZYbOep3H447tEDREmsibXUY8fY/03xHThGEzL5FLguIdE1pt57IIx2jCAeKmTwEv4q5y mmFlBU9s/aTGJDI1IFX2+dFW0WwynIkjZQSsDDt2Bl9wBmqjtjtrP4gkqg0cfvBUadVT 6lHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SbZB0SzK; 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 q9-20020aa7cc09000000b004615a57e292si110611edt.426.2022.10.24.09.00.14; Mon, 24 Oct 2022 09:00:43 -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=@gmail.com header.s=20210112 header.b=SbZB0SzK; 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 S230115AbiJXPjK (ORCPT + 99 others); Mon, 24 Oct 2022 11:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbiJXPil (ORCPT ); Mon, 24 Oct 2022 11:38:41 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F78113DEB for ; Mon, 24 Oct 2022 07:27:39 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id w10so326209qvr.3 for ; Mon, 24 Oct 2022 07:27:39 -0700 (PDT) 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=71eY0kkxWRwBjV2G3scfnzcrcRhO3rXFbeUg0pv3GQg=; b=SbZB0SzKD6Kfk9toYCVYMMukZREinAmvmWVRwReClqYqhZ7XS+/jdZsB5JSJcIOOf6 VCBoighcYhc9+zC4y4yZ/QIDTkcwrlHACa/rpGqjjl3zdn6WKoEijhrimqiVinXLfEwH tB77iv9eLdW+aUM9ZPDSW9pU7aTWQ5oSuoHI+XeVP9/0ZWNwo4aTGn/6P0+E1k4bwOzC L0IIGZzpTrVk2hvDEAlWwuKMloGTX9Rh1GRJuKPXmDB76AiDqYtWsoijQmJgJ4U3P4yJ TR1emGGyyhsf6irfJii9HvPO+Di0grFDve7+eGDi5HSwriz4LeLKOcR/c1+eDoCcZgip M0wQ== 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=71eY0kkxWRwBjV2G3scfnzcrcRhO3rXFbeUg0pv3GQg=; b=17xZPQxIVTFQ5Lqi3VbfecMWcQq1NBmQWKCsmJcCdwz4/qE4tNkpAZFP/6TgZt7/Xa up0aNxlwRE4PVzQvKiMSzsHiqprLNW907nuxCyXVKOoa+E060CSsoeeINGkGWQXANFsj 5pd+clp4/Iz3ak5tIS+NJIrH4s3BJ5FQn6xjCzHAdpFf7vP/LDlqkIJhgH+0QCdW2vQD 0i/AehDKpa6SnNGrIn6AhvWcfOW+RJCZiNT3Z06iQVPQrl8rBecH3sPvjpxzamQyeaXz Drl2pXhp701OMg2tyCFGFlpbhIOSw3yFBl2NtaRCtMPGsqh0SFyWyvvDfjcDV2I7tgl8 d5SA== X-Gm-Message-State: ACrzQf3RWI1ZVnOPVmwkslwKncxFDxm0Q2AIGU3AoYp6hGHi2yAJNpM7 zgyfG6yQuqkdJ3vDdBFWZT9PxyhcqSo= X-Received: by 2002:a17:903:1381:b0:186:8bdb:6865 with SMTP id jx1-20020a170903138100b001868bdb6865mr11686619plb.166.1666619564779; Mon, 24 Oct 2022 06:52:44 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id p12-20020a17090a748c00b0020aacde1964sm4011403pjk.32.2022.10.24.06.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 06:52:43 -0700 (PDT) Date: Mon, 24 Oct 2022 22:52:38 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Baoquan He Cc: linux-kernel@vger.kernel.org, Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin Subject: Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Message-ID: References: <20221024081435.204970-1-bhe@redhat.com> <20221024081435.204970-9-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221024081435.204970-9-bhe@redhat.com> X-Spam-Status: No, score=-0.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, Oct 24, 2022 at 04:14:35PM +0800, Baoquan He wrote: > SLUB allocator relies on percpu allocator to initialize its ->cpu_slab > during early boot. For that, the dynamic chunk of percpu which serves > the early allocation need be large enough to satisfy the kmalloc > creation. > > However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't > consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that > with correct calculation. > > Signed-off-by: Baoquan He > Cc: Christoph Lameter > Cc: Pekka Enberg > Cc: David Rientjes > Cc: Joonsoo Kim > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Roman Gushchin > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> > --- > mm/slub.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 157527d7101b..8ac3bb9a122a 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n) > static inline int alloc_kmem_cache_cpus(struct kmem_cache *s) > { > BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE < > - KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu)); > + NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * > + sizeof(struct kmem_cache_cpu)); > > /* > * Must align to double word boundary for the double cmpxchg Looks good to me. Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thanks! > -- > 2.34.1 > -- Thanks, Hyeonggon