Re: mmotm 2021-08-05-19-46 uploaded (mm/filemap.c)

From: SeongJae Park
Date: Fri Aug 06 2021 - 05:22:59 EST


From: SeongJae Park <sjpark@xxxxxxxxx>

Hello Randy,

On Thu, 5 Aug 2021 22:00:11 -0700 Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:

[...]
>
> on i386, I am seeing lots of build errors due to references to
> some PAGE_ flags that are only defined for 64BIT:
>
> In file included from ../mm/filemap.c:44:0:
> ../include/linux/page_idle.h: In function ‘folio_test_young’:
> ../include/linux/page_idle.h:25:18: error: ‘PAGE_EXT_YOUNG’ undeclared (first use in this function); did you mean ‘PAGEOUTRUN’?
> return test_bit(PAGE_EXT_YOUNG, &page_ext->flags);
> ^~~~~~~~~~~~~~
> PAGEOUTRUN
[...]
>
> See:
> --- a/include/linux/page_ext.h~mm-idle_page_tracking-make-pg_idle-reusable
> +++ a/include/linux/page_ext.h
> @@ -19,7 +19,7 @@ struct page_ext_operations {
> enum page_ext_flags {
> PAGE_EXT_OWNER,
> PAGE_EXT_OWNER_ALLOCATED,
> -#if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
> +#if defined(CONFIG_PAGE_IDLE_FLAG) && !defined(CONFIG_64BIT)
> PAGE_EXT_YOUNG,
> PAGE_EXT_IDLE,
> #endif

Thanks for this report! However, the flag is not defined for only-64BIT but
none-64BIT.

'enum page_ext_flags' is defined when 'CONFIG_PAGE_EXTENSION' is set. It is
automatically set for non-64BIT when 'CONFIG_IDLE_PAGE_TRACKING' or
'CONFIG_DAMON_VADDR' is set. However, 'CONFIG_PAGE_IDLE_FLAG' doesn't. So, if
'CONFIG_PAGE_IDLE_FLAG' is set but 'CONFIG_PAGE_EXTENSION' is not, this issue
can be reproduced.

I was able to reproduce this issue with:

make ARCH=i386 allnoconfig
echo 'CONFIG_PAGE_IDLE_FLAG=y' >> .config
make olddefconfig
make ARCH=i386

And, confirmed below change fixes it.

--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -741,6 +741,7 @@ config DEFERRED_STRUCT_PAGE_INIT

config PAGE_IDLE_FLAG
bool "Add PG_idle and PG_young flags"
+ select PAGE_EXTENSION if !64BIT
help
This feature adds PG_idle and PG_young flags in 'struct page'. PTE
Accessed bit writers can set the state of the bit in the flags to let

Also, below change would make more sense:

@@ -749,7 +750,6 @@ config PAGE_IDLE_FLAG
config IDLE_PAGE_TRACKING
bool "Enable idle page tracking"
depends on SYSFS && MMU && BROKEN
- select PAGE_EXTENSION if !64BIT
select PAGE_IDLE_FLAG
help
This feature allows to estimate the amount of user pages that have
diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig
index 455995152697..37024798a97c 100644
--- a/mm/damon/Kconfig
+++ b/mm/damon/Kconfig
@@ -27,7 +27,6 @@ config DAMON_KUNIT_TEST
config DAMON_VADDR
bool "Data access monitoring primitives for virtual address spaces"
depends on DAMON && MMU
- select PAGE_EXTENSION if !64BIT
select PAGE_IDLE_FLAG
help
This builds the default data access monitoring primitives for DAMON

I will format these as patches and post soon.


Thanks,
SeongJae Park

>
>
> --
> ~Randy
> Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>