Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp753949rwb; Sun, 6 Nov 2022 13:15:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zi5z8X8BdRAGTt+GZR1orWWeOC7RtLh5j9VuM3B1lEeczP8VwOF4J8BRy0ijoBhprJy3X X-Received: by 2002:a17:902:f14a:b0:188:71b1:3061 with SMTP id d10-20020a170902f14a00b0018871b13061mr10214672plb.94.1667769341730; Sun, 06 Nov 2022 13:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667769341; cv=none; d=google.com; s=arc-20160816; b=yk28PFoGQ0BwHDQ8YSInA8tOthpQLhkCfSqZduBYUNdSZwFG999aZOPgzifplFS3NL /+OD0LNCuGQqiMy5B9LnIkuD/zTZ9u9++Rqcox6wIt0LruTbLH141rKhCAHr/83vLejo /CfR0nVtCPxgYAX8bDY++nCs0hwS3MjIoz3Gwnb4v7XyfhHZbRe5XnJq82HaFA3vJAg/ HidKlcAr0465Trl0i43n4USJFqxsD0+P/3370wtqgGfLNMr6NWmo+mWVr/kKiDiHbYwL b6XTU5J7Fefz1lGMMKm70n0uOV/zlOky3Fwe3mAvSQK+cyxFjHJ9WTUieEktbex3gxcC GWug== 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=ZtjHZhTXVaGjQcJVa95fXnoOmRq7kv/Z46oADISZGSU=; b=Zi+qTmHSP60QMTfPeYj8plnsAG5sTB71QFx/MUGEi6hFh8rkUkSkKSx08qPzwMH5kd YXi2oM25E0NAUlBMchllLLwV7yjyju7s3+RWWdkwi6YPTL5f8aUa9MyvR4K7m4tSBsxq KqxjDbugapUzqXIElgvLna32+8eorZxwQlyEtknNK7TWPa1aLEXl0/eeTLdAtoKEkIXt 0plCFKGTXkHBB+goO9H34MB7RYVRNCbW7ON9H6dK8uoGDpsC0I8XTEPrVSLDnUV2b7b3 W1wDWy6WCgX5ZkgXmIIX+GJtbcbQu8a+Mk9pe8neUprxg0P+szfk9HmsbDY+9f9gtcWJ j6+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=HAkMG7zH; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=EpUpFW9X; 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 i8-20020a170902c94800b001836e510540si9542803pla.114.2022.11.06.13.15.26; Sun, 06 Nov 2022 13:15:41 -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=@suse.cz header.s=susede2_rsa header.b=HAkMG7zH; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=EpUpFW9X; 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 S229995AbiKFU4J (ORCPT + 95 others); Sun, 6 Nov 2022 15:56:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiKFU4H (ORCPT ); Sun, 6 Nov 2022 15:56:07 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34FA5DFD2 for ; Sun, 6 Nov 2022 12:56:03 -0800 (PST) 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 3035E22522; Sun, 6 Nov 2022 20:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1667768161; 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=ZtjHZhTXVaGjQcJVa95fXnoOmRq7kv/Z46oADISZGSU=; b=HAkMG7zHvJxEfRZQcfZaiyCQUnZF0sQ/QvviRRjN25NoY7CJSDKuBxNzNmihz6WLaoCvM0 jyc4wJWWQ8Xszwc7gXwNppmN351gq8BMZ79vMUtOqr2r/XE4LehQQ6QmOuDc2qcapN8vdn QRQ7R6G1YDKkTCkW7Vvd0EByzFdjWBY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1667768161; 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=ZtjHZhTXVaGjQcJVa95fXnoOmRq7kv/Z46oADISZGSU=; b=EpUpFW9X9hU+kQuKMsWg56gKGJ4tA5iKd++PJ3c7LApVcYUZzDZj1b117Ks1wAfrbEVgyd Cgz/3xzQD5ets6AQ== 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 E42B9132E7; Sun, 6 Nov 2022 20:56:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 43rbNmAfaGMOBwAAMHmgww (envelope-from ); Sun, 06 Nov 2022 20:56:00 +0000 Message-ID: Date: Sun, 6 Nov 2022 21:56:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Content-Language: en-US To: Baoquan He , linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com> References: <20221024081435.204970-1-bhe@redhat.com> <20221024081435.204970-9-bhe@redhat.com> From: Vlastimil Babka In-Reply-To: <20221024081435.204970-9-bhe@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 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 10/24/22 10:14, 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(-) As only slub is touched and there's no prerequsities in the previous patches, I took this to the slab tree, branch slab/for-6.2/cleanups Thanks! > > 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