From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFDE7C433FE for ; Tue, 15 Nov 2022 09:09:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46E586B0071; Tue, 15 Nov 2022 04:09:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 41EC76B0072; Tue, 15 Nov 2022 04:09:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E65A6B0073; Tue, 15 Nov 2022 04:09:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1CC906B0071 for ; Tue, 15 Nov 2022 04:09:02 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DCB32140A56 for ; Tue, 15 Nov 2022 09:09:01 +0000 (UTC) X-FDA: 80135102082.26.57A7C3A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 68C978000A for ; Tue, 15 Nov 2022 09:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668503340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ojBLffwKMQ5rVID4Z1iY/wBuYEnsh9V8e1sz6MJA2HA=; b=I0kp9VjzRIzSNoiIOTWydm68a0aXGnAZoIkWC1ZoswnDjqLxf7QmiKPyhDWOepBqM34st7 xegy5tniAHswYtSZ9fy6jk+kLWIZo3aTW2pKUcEvOcHM2N1pv1XZDCaVjxZ9Cf3T6nbjw6 B3I6q57bg6VwpLjHoFc+Kqv4SbfD97M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-533-zouKz6OTOROOLLkY-7wFUg-1; Tue, 15 Nov 2022 04:08:57 -0500 X-MC-Unique: zouKz6OTOROOLLkY-7wFUg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DF73B1C09C84; Tue, 15 Nov 2022 09:08:56 +0000 (UTC) Received: from localhost (ovpn-12-71.pek2.redhat.com [10.72.12.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 137332024CC0; Tue, 15 Nov 2022 09:08:55 +0000 (UTC) Date: Tue, 15 Nov 2022 17:08:52 +0800 From: Baoquan He To: Dennis Zhou Cc: Vlastimil Babka , kernel test robot , oe-kbuild-all@lists.linux.dev, Linux Memory Management List , 42.hyeyoo@gmail.com Subject: Re: [linux-next:master 5002/7443] include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_474' declared with attribute error: BUILD_BUG_ON failed: PERCPU_DYNAMIC_EARLY_SIZE < NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu) Message-ID: References: <202211120436.HzD1i2yQ-lkp@intel.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668503341; a=rsa-sha256; cv=none; b=VzOu5wMCnUW8vzrDbFc/ieXeV9ACebSxB03VDhV4P4Ma4XSdDGOzKcJfnGh5Y77A/tgtjG nqI7kUdKeFqKhoiHTrNisDkPsxwyjryZreQ7sR0z99P+jwzMSkupqySihkvCm1iluY0JZS ZF+/2zSTU0xX1Q92yCZCz4DFV3qF5BQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I0kp9Vjz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668503341; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ojBLffwKMQ5rVID4Z1iY/wBuYEnsh9V8e1sz6MJA2HA=; b=Tx/ej+AIgVDfTflOVqinaAQP10PABJbnLB/h/qWbNA7jRohdufUvvjjVmzOflUtepba5Tp X4vYRO/We9J79dzV528ScLLhuWXzeesGFy/SqTsj2md951FZumyPU0qABc1VibE89EHiqj XbpGKT6DbJnhj4qsdHKD+Kxw9RePoeg= X-Rspamd-Queue-Id: 68C978000A Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I0kp9Vjz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: r99fdtecbyjx1aqy6w9zdjktqrf8juzp X-HE-Tag: 1668503341-148533 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Dennis, On 11/14/22 at 08:13pm, Dennis Zhou wrote: > Hi Vlastimil & Baoquan, > > On Mon, Nov 14, 2022 at 06:58:13PM +0100, Vlastimil Babka wrote: > > On 11/14/22 08:44, Baoquan He wrote: > > > Hi, > > > > > > I reproduced the build failure according to lkp report and made a patch > > > as below to fix it. > > > > > > From dae7dd9705015ce36db757e88c78802584f949b1 Mon Sep 17 00:00:00 2001 > > > From: Baoquan He > > > Date: Sun, 13 Nov 2022 18:08:27 +0800 > > > Subject: [PATCH] percpu: adjust the value of PERCPU_DYNAMIC_EARLY_SIZE > > > Content-type: text/plain > > > > > > LKP reported a build failure as below on the patch "mm/slub, percpu: > > > correct the calculation of early percpu allocation size" > > > > Since I have that patch in slab.git exposed to -next, should I take this fix > > too, to make things simpler? Dennis? > > > > I don't have any problems with you running a fix, but I'm not quite sure > this is the right fix. Though this might cause a trivial merge conflict > with: d667c94962c1 ("mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS") > in my percpu#for-6.2 branch. > > If I'm understanding this correctly, slub requires additional percpu > memory due to the use of 64k pages. By increasing > PERCPU_DYNAMIC_EARLY_SIZE, we solve the problem for 64k page users, but > require a few unnecessary pages that can bloat the size of subsequent > percpu chunks. Though, I'm not sure if that's an issue today for > embedded devices. Thanks for looking into this. I guess you are talking about PERCPU_DYNAMIC_EARLY_SIZE will impact the first dynamic chunk size of page first chunk, because the embed first chunk will take PERCPU_DYNAMIC_RESERVE. And the impact is done in below max() invacation. static struct pcpu_alloc_info * __init __flatten pcpu_build_alloc_info( size_t reserved_size, size_t dyn_size, size_t atom_size, pcpu_fc_cpu_distance_fn_t cpu_distance_fn) { ...... /* calculate size_sum and ensure dyn_size is enough for early alloc */ size_sum = PFN_ALIGN(static_size + reserved_size + max_t(size_t, dyn_size, PERCPU_DYNAMIC_EARLY_SIZE)); ...... } > > I think adding parity to PERCPU_DYNAMIC_EARLY_SIZE with > PERCPU_DYNAMIC_RESERVE is defined by BITS_PER_LONG is a safer option > here. A small TODO item would be to make PERCPU_DYNAMIC_RESERVE be a + > value instead of a max() with PERCPU_DYNAMIC_EARLY_SIZE. Hmm, the below change may not take power arch into account. Please check arch/powerpc/include/asm/page.h, seems the 32bit ppc could have 256K pages too. Adding PERCPU_DYNAMIC_EARLY_SIZE to 20K may cost extra memory during boot. But th left space of 1st dynamic chunk will join the later percpu dynamic allocation, it's not wasted, right? Not sure if I got your point. > > --- > diff --git a/include/linux/percpu.h b/include/linux/percpu.h > index f1ec5ad1351c..22ce3271eed2 100644 > --- a/include/linux/percpu.h > +++ b/include/linux/percpu.h > @@ -42,7 +42,11 @@ > * larger than PERCPU_DYNAMIC_EARLY_SIZE. > */ > #define PERCPU_DYNAMIC_EARLY_SLOTS 128 > +#if BITS_PER_LONG > 32 > +#define PERCPU_DYNAMIC_EARLY_SIZE (20 << 10) > +#else > #define PERCPU_DYNAMIC_EARLY_SIZE (12 << 10) > +#endif > > /* > * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy >