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 04BEEC3A59D for ; Sun, 7 Apr 2024 04:04:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FC166B0085; Sun, 7 Apr 2024 00:04:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7841E6B0087; Sun, 7 Apr 2024 00:04:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FD766B0088; Sun, 7 Apr 2024 00:04:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 41D506B0085 for ; Sun, 7 Apr 2024 00:04:26 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C134B1607E8 for ; Sun, 7 Apr 2024 04:04:25 +0000 (UTC) X-FDA: 81981393690.20.F483F18 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by imf28.hostedemail.com (Postfix) with ESMTP id 969D3C000A for ; Sun, 7 Apr 2024 04:04:22 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fuged8FA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.161.47 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712462662; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NXUQaOMb8FeVjuZAbtCgzIw0cQ+eVQ5kKzJJGCn84fU=; b=gVGh+P7BRHmyDaEDXDPc/K6ehWYn7zPKCQVeehI9Dbv48IF1P25HeqsAL3ubAxZTjQpATB HknG/rgqUJXVpg/kgv/x2kXR+XdtUQWQMvl0bmTtLJz5PEV/FNYzo355tEsc3+aJiFFB4h pWJmsTnp1ivuo2nJNniaxrEbX909/nw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fuged8FA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.161.47 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712462662; a=rsa-sha256; cv=none; b=7NxUaAF3D3o7Nc+2UxVQADaal2zAyMVBGzQNNrQtu399UbMUqvE6EM6gxrshDnKpA5Nw85 IB+VVg0Pt5qyCtArkkWHhIbwu/r76v7A6ZOQhHyUXIUrtkL4pcBF2eAylS3UXJUKU5no/l dMOgjD3z403aUgxOfUCqVmtz0XCKrzc= Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5aa1e9527d1so498903eaf.1 for ; Sat, 06 Apr 2024 21:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712462661; x=1713067461; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NXUQaOMb8FeVjuZAbtCgzIw0cQ+eVQ5kKzJJGCn84fU=; b=fuged8FA77CcZz8KsfYtpDBUNFNzNma77SP1wZasqfnMk6YihuBSD1IOCCN+GVUQrB BmasRhQ3bVwdzkIQJLYrlBmB8AlyMXPZa1hJAtMxWdbfLG/BTxSSBIoec+HPwbj+pDH6 hfJTcGKbGlaRoQccnkNWigjJYZist07ghJEQS34vP0JWuzSyiX/2+3a8VpEBfMW58fmk d46bbTZszHbRPXa+1JXmA8w0blYslzucE/EDrYzah1KJmLU2+ACQlRLFi40pKFyvogbV Lsnd5xZgDXergwwSNkmq1YIgxOAnQOZRhm6qdDRv4R/bV12mxTnGaCH6/wMEGmkZe0Bh UJQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712462661; x=1713067461; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NXUQaOMb8FeVjuZAbtCgzIw0cQ+eVQ5kKzJJGCn84fU=; b=HbLhL2Ue/RbQCUT6xOnT+uYlCei6NouHz+Etl98i3ExfdSa8MFYDZ0BPyacBFg8kso 7Eh5Sr6klaGiIYZAmWFoCY/0BT4QOZ9GIPm0dAGFVbmcocm9PiF3EcKlEYPv4YCSbxu3 Aecbs1Fl781Ar56Y7KgyFESY+qCdxoqGw+ImB+pTsY5CNnVDuz2XnFDYWGeUdLhiy3yy pPzy51+ByVWKSLnnxWCJi2u1SmZ+3nzCVcCn+DxSRYDQLUsNG2uvYKlLQ7ARTpAV2PgN gRBAZQTdM5LTlLhFdbAi8ghowE/7ZjIhz+nXRbvaGzuq7KgKXqbgI/Zwomlbw8rz4q9u avUg== X-Forwarded-Encrypted: i=1; AJvYcCW1xr3JbxdJolPcMgvly2pbyr50W3kn2edq3/8oulxAneN4fg2wyM9TpjUpREu1MA04NP6gpfR7nUZ4ktIpuca+oXo= X-Gm-Message-State: AOJu0YyD/tis4+5x6UhJivLuJf6Kua1/pH8RPKo6tm7syFZwJwoYBduZ D+iZ3IEuYpO3FJIe26BICWaARa/qRd6YeObb1rXgp7a9PIs2wFQkrrZSV2Z2garqx3ihGY1ayo2 MREJqkBe+GJOWMF3Riqza4z+TzVs= X-Google-Smtp-Source: AGHT+IH2s7sGG91mjzo45QDfSs8VxLriFL8GdGUJo48nxTr5Tgn3DIGmyRGVzLkA4/xYxdk5jkrXJoHykMqas086WYI= X-Received: by 2002:a05:6358:7a8f:b0:183:f215:6468 with SMTP id f15-20020a0563587a8f00b00183f2156468mr5160605rwg.11.1712462661450; Sat, 06 Apr 2024 21:04:21 -0700 (PDT) MIME-Version: 1.0 References: <202404061627.ungVloow-lkp@intel.com> <20240407005229.103923-1-21cnbao@gmail.com> In-Reply-To: <20240407005229.103923-1-21cnbao@gmail.com> From: Barry Song <21cnbao@gmail.com> Date: Sun, 7 Apr 2024 16:04:10 +1200 Message-ID: Subject: Re: [akpm-mm:mm-unstable 313/322] include/linux/huge_mm.h:274:23: error: variably modified 'stats' at file scope To: lkp@intel.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, oe-kbuild-all@lists.linux.dev, v-songbaohua@oppo.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 969D3C000A X-Stat-Signature: 88qfhpjtr6md1xnrcmsz9t79gdzns11q X-HE-Tag: 1712462662-843268 X-HE-Meta: U2FsdGVkX1/Wu0B61zkBpzOygQh00Y756UEPAy6Rvwo9KT2HHOFChHpPzfWBF48YkKND7XH8sM+rhgZe/itm3QV+7eLuVA/gJ2QJzNgfVPJDB/u+G+0wm++wfarZhHM799Sy4N2SFTVEoP01WJIP8dqc6tAn/PmqEzv8Dq89Vdcviw8THhy7r27O50oj/lv3uUltBzIrYkvpB9ftTS/AtRI+w7azdXmtPev/HCl3OJdjiFlRqwn2Q0E6Nb07mpiim4Ob69jDwE6yI8nr1VnoyhoTCPac5a1oORMENOsq9f0i6GF0UYBhHP2hyxdM4scStnwdiMyU7gaygsxEUDUUpY3VgGFqFjHPnzTQdzywRzy+hs2KKHkyilqWnfkwwncm8IYi6pHDw/iElKsGCUObpRaZbmr+/SIyvMx2wz6piaGo3J+UNkV+CEj9aATysKRkwF3WiZXHGR2CFk7BzOZLB5lPCGmpUrgCaFucNdH3oCN6IDMHy2Mnw/7jBv6V95CYxRj28DvIQgMMs/PW2gJlQWa8eUorhsPgikVcg+gllpV/vg+sQNbUEI9UqbWbt/UlWhkhux0iWf4SrbeYvD6jB3Ax4MBoGi6EwEv36OdubXEZOFAKIiM43SAueSQEAJDaOVU4e4wYH38cfOK1O0ZBwu1pWg4V9dRc53gTPJJ4Px7WeaMNwCdhQsyh/1rCiFbFVbOO2WujWiODGSqx82J/eGUC1sXeHFKgrfh5khCbxLHgbHkPO/sJ52yU+GTk5j4BTDxdHVhgYUAkBlqL91u4NnHMWI9WqeqHvdgVhd4NwS47r5W3a8LZ5Gg5NcZPkJP8zb70GwxDKnOrFe3zB8AdLl0V+T5ZQrUMmkh0ELbi6bxC9RPR19ICrxXH+tuBbDnx/D0oEN7jN3BTDvR8pTxSE9EJKjyCHURtmwKvxJDFLm/5HR8s4RuOjTlDjyavJx+qLh6k+AFzZ42l/fyLmMB bI+fwCXm VXmpY5ri9qUg5BkL5K1zsMBPDRWHxm3JOVaaLFOFM/ym9jdTCEBDhHgPxGf43YSbTiM6NKrckGTX8LUg= 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: List-Subscribe: List-Unsubscribe: On Sun, Apr 7, 2024 at 12:52=E2=80=AFPM Barry Song <21cnbao@gmail.com> wrot= e: > > > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-= unstable > > head: f43b3aae94511d62174c3b29239da0dd22d0eeb3 > > commit: d4358ee0a075e232114dfec0cd162860cfa2771b [313/322] mm: add per-= order mTHP anon_alloc and anon_alloc_fallback counters > > config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/2= 0240406/202404061627.ungVloow-lkp@intel.com/config) > > compiler: powerpc64-linux-gcc (GCC) 13.2.0 > > reproduce (this is a W=3D1 build): (https://download.01.org/0day-ci/arc= hive/20240406/202404061627.ungVloow-lkp@intel.com/reproduce) > > > > If you fix the issue in a separate patch/commit (i.e. not just a new ve= rsion of > > the same patch/commit), kindly add following tags > > | Reported-by: kernel test robot > > | Closes: https://lore.kernel.org/oe-kbuild-all/202404061627.ungVloow-l= kp@intel.com/ > > > All errors (new ones prefixed by >>): > > > > In file included from include/linux/mm.h:1115, > > from include/linux/mman.h:5, > > from arch/powerpc/kernel/asm-offsets.c:19: > >>> include/linux/huge_mm.h:274:23: error: variably modified 'stats' at f= ile scope > > 274 | unsigned long stats[PMD_ORDER + 1][__MTHP_STAT_COUNT= ]; > > | ^~~~~ > > make[3]: *** [scripts/Makefile.build:117: arch/powerpc/kernel/asm-of= fsets.s] Error 1 > > Should have been fixed by: > > From 573aa50dbebcd4b2650d477374b28aa53c21b968 Mon Sep 17 00:00:00 2001 > From: Barry Song > Date: Sun, 7 Apr 2024 12:23:35 +1200 > Subject: [PATCH] mm: fix powerpc build issue > > Signed-off-by: Barry Song > --- > include/linux/huge_mm.h | 9 ++++----- > mm/huge_memory.c | 13 +++++++++++-- > 2 files changed, 15 insertions(+), 7 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index c5d33017a4dd..0717063dc5e7 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -271,16 +271,15 @@ enum mthp_stat_item { > }; > > struct mthp_stat { > - unsigned long stats[PMD_ORDER + 1][__MTHP_STAT_COUNT]; > + unsigned long stats[0][__MTHP_STAT_COUNT]; > }; > > -DECLARE_PER_CPU(struct mthp_stat, mthp_stats); > +extern struct mthp_stat __percpu *mthp_stats; > > static inline void count_mthp_stat(int order, enum mthp_stat_item item) > { > - if (unlikely(order > PMD_ORDER)) > - return; > - this_cpu_inc(mthp_stats.stats[order][item]); > + if (likely(order <=3D PMD_ORDER)) > + raw_cpu_ptr(mthp_stats)->stats[order][item]++; > } > > #define transparent_hugepage_use_zero_page() \ > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 5b875f0fc923..10bc3f54cb81 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -526,7 +526,7 @@ static const struct kobj_type thpsize_ktype =3D { > .sysfs_ops =3D &kobj_sysfs_ops, > }; > > -DEFINE_PER_CPU(struct mthp_stat, mthp_stats) =3D {{{0}}}; > +struct mthp_stat __percpu *mthp_stats; > > static unsigned long sum_mthp_stat(int order, enum mthp_stat_item item) > { > @@ -534,7 +534,7 @@ static unsigned long sum_mthp_stat(int order, enum mt= hp_stat_item item) > int cpu; > > for_each_online_cpu(cpu) { > - struct mthp_stat *this =3D &per_cpu(mthp_stats, cpu); > + struct mthp_stat *this =3D per_cpu_ptr(mthp_stats, cpu); > > sum +=3D this->stats[order][item]; > } > @@ -602,6 +602,7 @@ static struct thpsize *thpsize_create(int order, stru= ct kobject *parent) > static void thpsize_release(struct kobject *kobj) > { > kfree(to_thpsize(kobj)); > + free_percpu(mthp_stats); > } > > static int __init hugepage_init_sysfs(struct kobject **hugepage_kobj) > @@ -636,6 +637,13 @@ static int __init hugepage_init_sysfs(struct kobject= **hugepage_kobj) > goto remove_hp_group; > } > > + mthp_stats =3D (struct mthp_stat __percpu *)alloc_percpu((PMD_ORD= ER + 1) * > + sizeof(sizeof(mthp_stats->stats[0= ]))); sorry. I made the wrong allocation size. please change the above two lines to the below when you test the patch: + mthp_stats =3D __alloc_percpu((PMD_ORDER + 1) * sizeof(mthp_stats->stats[0]), + sizeof(unsigned long)); > + if (!mthp_stats) { > + err =3D -ENOMEM; > + goto remove_hp_group; > + } > + > orders =3D THP_ORDERS_ALL_ANON; > order =3D highest_order(orders); > while (orders) { > @@ -673,6 +681,7 @@ static void __init hugepage_exit_sysfs(struct kobject= *hugepage_kobj) > sysfs_remove_group(hugepage_kobj, &khugepaged_attr_group); > sysfs_remove_group(hugepage_kobj, &hugepage_attr_group); > kobject_put(hugepage_kobj); > + free_percpu(mthp_stats); > } > #else > static inline int hugepage_init_sysfs(struct kobject **hugepage_kobj) > -- > 2.34.1 > Thanks Barry