[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK1f24nB8D+zgphX3XXLWRq0_xwT+7EfV8dfxNmkHh_CCQrA-A@mail.gmail.com>
Date: Tue, 7 May 2024 14:50:33 +0800
From: Lance Yang <ioworker0@...il.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: 21cnbao@...il.com, akpm@...ux-foundation.org, david@...hat.com,
hughd@...gle.com, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
ryan.roberts@....com, shy828301@...il.com, wangkefeng.wang@...wei.com,
willy@...radead.org, ying.huang@...el.com, ziy@...dia.com
Subject: Re: [PATCH 0/8] add mTHP support for anonymous shmem
On Tue, May 7, 2024 at 9:47 AM Baolin Wang
<baolin.wang@...ux.alibaba.com> wrote:
>
> Hi Lance,
>
> On 2024/5/6 18:54, Lance Yang wrote:
> > Hey Baolin,
> >
> > I found a compilation issue that failed one[1] of my configurations
> > after applying this series. The error message is as follows:
> >
> > mm/shmem.c: In function ‘shmem_get_unmapped_area’:
> > ././include/linux/compiler_types.h:460:45: error: call to ‘__compiletime_assert_481’ declared with attribute error: BUILD_BUG failed
> > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> > ^
> > ././include/linux/compiler_types.h:441:25: note: in definition of macro ‘__compiletime_assert’
> > prefix ## suffix(); \
> > ^~~~~~
> > ././include/linux/compiler_types.h:460:9: note: in expansion of macro ‘_compiletime_assert’
> > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> > ^~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
> > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > ^~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
> > #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
> > ^~~~~~~~~~~~~~~~
> > ./include/linux/huge_mm.h:97:28: note: in expansion of macro ‘BUILD_BUG’
> > #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> > ^~~~~~~~~
> > ./include/linux/huge_mm.h:104:35: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
> > #define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
> > ^~~~~~~~~~~~~~~
> > mm/shmem.c:2419:36: note: in expansion of macro ‘HPAGE_PMD_SIZE’
> > unsigned long hpage_size = HPAGE_PMD_SIZE;
> > ^~~~~~~~~~~~~~~
> >
> > It seems like we need to handle the case where CONFIG_PGTABLE_HAS_HUGE_LEAVES
> > is undefined.
> >
> > [1] export ARCH=arm64 && make allnoconfig && make olddefconfig && make -j$(nproc)
>
> Thanks for reporting. I can move the use of HPAGE_PMD_SIZE to after the
> check for CONFIG_TRANSPARENT_HUGEPAGE, which can avoid the building error:
I confirmed that the issue I reported before has disappeared after applying
this change. For the fix,
Tested-by: Lance Yang <ioworker0@...il.com>
Thanks,
Lance
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 1af2f0aa384d..d603e36e0f4f 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2416,7 +2416,7 @@ unsigned long shmem_get_unmapped_area(struct file
> *file,
> unsigned long inflated_len;
> unsigned long inflated_addr;
> unsigned long inflated_offset;
> - unsigned long hpage_size = HPAGE_PMD_SIZE;
> + unsigned long hpage_size;
>
> if (len > TASK_SIZE)
> return -ENOMEM;
> @@ -2446,6 +2446,7 @@ unsigned long shmem_get_unmapped_area(struct file
> *file,
> if (uaddr == addr)
> return addr;
>
> + hpage_size = HPAGE_PMD_SIZE;
> if (shmem_huge != SHMEM_HUGE_FORCE) {
> struct super_block *sb;
> unsigned long __maybe_unused hpage_orders;
Powered by blists - more mailing lists