Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7285742rwi; Mon, 24 Oct 2022 12:22:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7r6/tdQULTmSP9J+ZFLbhaBi8uhZUCLr6Xfhsb5/i9OgaB+yVdnxgkHlv/ZthL+Hzk6a37 X-Received: by 2002:a17:907:2cd8:b0:78d:9c3c:d788 with SMTP id hg24-20020a1709072cd800b0078d9c3cd788mr29463659ejc.327.1666639339920; Mon, 24 Oct 2022 12:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639339; cv=none; d=google.com; s=arc-20160816; b=WmgDbF0ELEMS/9obCniHrBhxmmxOipVdRE1VLxTvMvG3qqD8lwLSsjaD/ztdyUHVvH QKlaV4yn0LubTJoDwRGSkfcEr99SdejdtOmkn+cXQrbXxn0hTMJ968/fNxBTJVlQey3V F1lMBKH6I8TYBU/Xk2FHR8yP44t2yTWxrAuGZ3GNDZ3bWwXAwKIwf9M0ffxpz0BazRsp /i3fSotpU4E7dDmr5GFdXTFd4ZnYohhIScY0U6kxpeq7aLux7Is4V7fzjjAmeUYUCZYM SdBpojhRL4CkaHJug/Vr7LnamIsmkBLMqdSxRQroFhuS3JFdspX7rPinDexBliX22+8H Ddvg== 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; bh=SNF81HjPeg63b6+jdQdpQLgEMtIaJrnM5MbXRIwld1I=; b=Bv12It/SllzzQY7sYmgqZzK42UgjEijPy83myUVel6ytxiGYq+1dkBi2wiiiE6LzXz y1IfLop9UlIIQdi/8u5gmAneWkGBOsD2I67uM98vS39a6C1NaePe2ojnntjXFqocvz+8 uCABYnptLDGFTMyc4jpRnguzLr7hJ3UQo+wtYA7c8Sl3FlAEEAnZaF7PbxnE1y7ypvtf b1HTOup8hxWkKYOvtKxZ/4yQUNEqSatLwLjJVaD9Z7wqtKmlXBPsguRWB7Km1IxTsG0H 9r2BeMu7Lw2yr7RJxN5Jp5emszBNY/0ZtnruRlacYFrpbLs4/U2LAOU520vFeIvihShc rcHQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a170906a11400b0078ddde15fdcsi484874ejy.279.2022.10.24.12.21.55; Mon, 24 Oct 2022 12:22:19 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbiJXSeN (ORCPT + 99 others); Mon, 24 Oct 2022 14:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbiJXSdc (ORCPT ); Mon, 24 Oct 2022 14:33:32 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAF8479A74 for ; Mon, 24 Oct 2022 10:15:12 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id g28so9496105pfk.8 for ; Mon, 24 Oct 2022 10:15:12 -0700 (PDT) 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=SNF81HjPeg63b6+jdQdpQLgEMtIaJrnM5MbXRIwld1I=; b=Apfhrnx6To3CGS8kKLBfUwYL3ebnjQ9TQ89XgQeA7CHQSL0DskUqakuUwzbfqemOJy GQnNzmJn3JtE68zDp91LbMIicQFSBMF6FaJ5cdZ9SGgvIMj0ja2AhXJRnN1AzFZZZSOv IkWyU3PrT4wKvl2VGzeIvYyj4KOoSyW17+iXffYjd4Zhl9EY0MxOE7EG0ew0gBIYW+wF BAwXf6OTT93ATolDyDgerau8YhoDhORRJlT7E/Ogi/NvnQM9h5uiF5YzRrTIwv3wo82t h/g6IsIci/MYd6SyFEUfZHb8pbvopB42GogYmAEyMi9QM0OenmAa6ve0uVut7Dl+lecv NXLQ== X-Gm-Message-State: ACrzQf3bKNnBnqlezSbC/xgfVmp91/GmEa+rsFdmEkA7MkHSUvaaXLOT yhozIuNh4cJCo4AUx+vIelMGpckqqs46BQ== X-Received: by 2002:a05:6a00:16c8:b0:53b:3b9f:7283 with SMTP id l8-20020a056a0016c800b0053b3b9f7283mr34350371pfc.46.1666631017116; Mon, 24 Oct 2022 10:03:37 -0700 (PDT) Received: from fedora (136-24-99-118.cab.webpass.net. [136.24.99.118]) by smtp.gmail.com with ESMTPSA id t7-20020a170902e84700b00176b3d7db49sm25884plg.0.2022.10.24.10.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 10:03:36 -0700 (PDT) Date: Mon, 24 Oct 2022 10:03:33 -0700 From: Dennis Zhou To: Baoquan He Cc: linux-kernel@vger.kernel.org, Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com> 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=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, 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 > -- > 2.34.1 > Acked-by: Dennis Zhou Thanks, Dennis