All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse
@ 2022-05-04 20:07 SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 1/3] mm/vmscan: Use folio_test_transhuge() for THP check SeongJae Park
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: SeongJae Park @ 2022-05-04 20:07 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-mm, linux-kernel, SeongJae Park

Several commits on 'mm-unstable' replaces 'PageTransHuge()' with
'folio_test_large()' instead of 'folio_test_transhuge()'.  As a result,
several build errors occur when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

This patchset fixes the issues by replacing the check to use
'folio_test_transhuge()'.

SeongJae Park (3):
  mm/vmscan: Use folio_test_transhuge() for THP check
  mm/shmem: Use folio_test_transhuge() for THP check
  mm/shmem: Use folio_test_transhuge() for THP check

 mm/shmem.c  | 8 ++++----
 mm/vmscan.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for mm-unstable 1/3] mm/vmscan: Use folio_test_transhuge() for THP check
  2022-05-04 20:07 [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse SeongJae Park
@ 2022-05-04 20:07 ` SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 2/3] mm/shmem: " SeongJae Park
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2022-05-04 20:07 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-mm, linux-kernel, SeongJae Park

Commit 22bf1b68e572 ("vmscan: remove remaining uses of page in
shrink_page_list") on 'mm-unstable' replaces 'PageTransHuge()' with
'folio_test_large()' instead of 'folio_test_transhuge()'.  This results
in below build error when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

      CC      mm/vmscan.o
    In file included from <command-line>:
    In function ‘can_split_folio’,
        inlined from ‘shrink_page_list’ at .../linux/mm/vmscan.c:1719:11:
    .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_178’ declared with attribute error: BUILD_BUG failed
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |                                      ^
    .../linux/include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’
      333 |    prefix ## suffix();    \
          |    ^~~~~~
    .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |  ^~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
          |                                     ^~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
       59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
          |                     ^~~~~~~~~~~~~~~~
    .../linux/include/linux/huge_mm.h:351:2: note: in expansion of macro ‘BUILD_BUG’
      351 |  BUILD_BUG();
          |  ^~~~~~~~~

This commit fixes the issue by replacing the check to use
'folio_test_transhuge()'.

Fixes: 22bf1b68e572 ("vmscan: remove remaining uses of page in shrink_page_list")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 40cda196d802..5a0f081a7be5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1714,7 +1714,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
 					goto keep_locked;
 				if (folio_maybe_dma_pinned(folio))
 					goto keep_locked;
-				if (folio_test_large(folio)) {
+				if (folio_test_transhuge(folio)) {
 					/* cannot split folio, skip it */
 					if (!can_split_folio(folio, NULL))
 						goto activate_locked;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for mm-unstable 2/3] mm/shmem: Use folio_test_transhuge() for THP check
  2022-05-04 20:07 [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 1/3] mm/vmscan: Use folio_test_transhuge() for THP check SeongJae Park
@ 2022-05-04 20:07 ` SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 3/3] " SeongJae Park
  2022-05-04 20:10 ` [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse Matthew Wilcox
  3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2022-05-04 20:07 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-mm, linux-kernel, SeongJae Park

Commit 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take
a folio") on 'mm-unstable' replaces 'PageTransHuge()' with
'folio_test_large()' instead of 'folio_test_transhuge()'.  This results
in below build error when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

      CC      mm/shmem.o
    In file included from <command-line>:
    In function ‘shmem_add_to_page_cache’,
        inlined from ‘shmem_getpage_gfp.isra.0’ at .../linux/mm/shmem.c:1912:10:
    .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_244’ declared with attribute error: BUILD_BUG failed
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |                                      ^
    .../linux/include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’
      333 |    prefix ## suffix();    \
          |    ^~~~~~
    .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |  ^~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
          |                                     ^~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
       59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
          |                     ^~~~~~~~~~~~~~~~
    .../linux/include/linux/vm_event_item.h:147:27: note: in expansion of macro ‘BUILD_BUG’
      147 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; })
          |                           ^~~~~~~~~
    .../linux/mm/shmem.c:743:19: note: in expansion of macro ‘THP_FILE_ALLOC’
      743 |    count_vm_event(THP_FILE_ALLOC);
          |                   ^~~~~~~~~~~~~~

This commit fixes the issue by replacing the check to use
'folio_test_transhuge()'.

Fixes: 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take a folio")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 6a18641a90ff..3dc34a5a7923 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -739,7 +739,7 @@ static int shmem_add_to_page_cache(struct folio *folio,
 		xas_store(&xas, folio);
 		if (xas_error(&xas))
 			goto unlock;
-		if (folio_test_large(folio)) {
+		if (folio_test_transhuge(folio)) {
 			count_vm_event(THP_FILE_ALLOC);
 			__lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr);
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for mm-unstable 3/3] mm/shmem: Use folio_test_transhuge() for THP check
  2022-05-04 20:07 [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 1/3] mm/vmscan: Use folio_test_transhuge() for THP check SeongJae Park
  2022-05-04 20:07 ` [PATCH for mm-unstable 2/3] mm/shmem: " SeongJae Park
@ 2022-05-04 20:07 ` SeongJae Park
  2022-05-04 20:10 ` [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse Matthew Wilcox
  3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2022-05-04 20:07 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-mm, linux-kernel, SeongJae Park

Commit 94cdf3e8c0bf ("mm/shmem: convert shmem_getpage_gfp to use a
folio") on 'mm-unstable' replaces 'PageTransHuge()' with
'folio_test_large()' instead of 'folio_test_transhuge()'.  This results
in below build error when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

      CC      mm/shmem.o
    In file included from .../linux/include/linux/kernel.h:25,
                     from .../linux/arch/x86/include/asm/percpu.h:27,
                     from .../linux/arch/x86/include/asm/preempt.h:6,
                     from .../linux/include/linux/preempt.h:78,
                     from .../linux/include/linux/spinlock.h:55,
                     from .../linux/include/linux/wait.h:9,
                     from .../linux/include/linux/wait_bit.h:8,
                     from .../linux/include/linux/fs.h:6,
                     from .../linux/mm/shmem.c:24:
    .../linux/mm/shmem.c: In function ‘shmem_getpage_gfp.isra.0’:
    .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_252’ declared with attribute error: BUILD_BUG failed
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |                                      ^
    .../linux/include/linux/math.h:15:46: note: in definition of macro ‘__round_mask’
       15 | #define __round_mask(x, y) ((__typeof__(x))((y)-1))
          |                                              ^
    .../linux/mm/shmem.c:1900:12: note: in expansion of macro ‘round_down’
     1900 |   hindex = round_down(index, HPAGE_PMD_NR);
          |            ^~~~~~~~~~
    .../linux/include/linux/compiler_types.h:340:2: note: in expansion of macro ‘__compiletime_assert’
      340 |  __compiletime_assert(condition, msg, prefix, suffix)
          |  ^~~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |  ^~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
          |                                     ^~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
       59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
          |                     ^~~~~~~~~~~~~~~~
    .../linux/include/linux/huge_mm.h:307:28: note: in expansion of macro ‘BUILD_BUG’
      307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
          |                            ^~~~~~~~~
    .../linux/include/linux/huge_mm.h:105:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
      105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
          |                          ^~~~~~~~~~~~~~~
    .../linux/include/linux/huge_mm.h:106:26: note: in expansion of macro ‘HPAGE_PMD_ORDER’
      106 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
          |                          ^~~~~~~~~~~~~~~
    .../linux/mm/shmem.c:1900:30: note: in expansion of macro ‘HPAGE_PMD_NR’
     1900 |   hindex = round_down(index, HPAGE_PMD_NR);
          |                              ^~~~~~~~~~~~
    In file included from <command-line>:
    .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_253’ declared with attribute error: BUILD_BUG failed
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |                                      ^
    .../linux/include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’
      333 |    prefix ## suffix();    \
          |    ^~~~~~
    .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’
      352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
          |  ^~~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
       39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
          |                                     ^~~~~~~~~~~~~~~~~~
    .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
       59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
          |                     ^~~~~~~~~~~~~~~~
    .../linux/include/linux/huge_mm.h:307:28: note: in expansion of macro ‘BUILD_BUG’
      307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
          |                            ^~~~~~~~~
    .../linux/include/linux/huge_mm.h:105:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
      105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
          |                          ^~~~~~~~~~~~~~~
    .../linux/include/linux/huge_mm.h:106:26: note: in expansion of macro ‘HPAGE_PMD_ORDER’
      106 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
          |                          ^~~~~~~~~~~~~~~
    .../linux/mm/shmem.c:1923:13: note: in expansion of macro ‘HPAGE_PMD_NR’
     1923 |    hindex + HPAGE_PMD_NR - 1) {
          |             ^~~~~~~~~~~~

Fixes: 94cdf3e8c0bf ("mm/shmem: convert shmem_getpage_gfp to use a folio")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/shmem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 3dc34a5a7923..c51d3532c962 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1888,7 +1888,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 		goto unlock;
 	}
 
-	if (folio_test_large(folio))
+	if (folio_test_transhuge(folio))
 		hindex = round_down(index, HPAGE_PMD_NR);
 	else
 		hindex = index;
@@ -1910,7 +1910,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 	spin_unlock_irq(&info->lock);
 	alloced = true;
 
-	if (folio_test_large(folio) &&
+	if (folio_test_transhuge(folio) &&
 	    DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE) <
 			hindex + HPAGE_PMD_NR - 1) {
 		/*
@@ -1973,7 +1973,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
 unacct:
 	shmem_inode_unacct_blocks(inode, folio_nr_pages(folio));
 
-	if (folio_test_large(folio)) {
+	if (folio_test_transhuge(folio)) {
 		folio_unlock(folio);
 		folio_put(folio);
 		goto alloc_nohuge;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse
  2022-05-04 20:07 [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse SeongJae Park
                   ` (2 preceding siblings ...)
  2022-05-04 20:07 ` [PATCH for mm-unstable 3/3] " SeongJae Park
@ 2022-05-04 20:10 ` Matthew Wilcox
  2022-05-04 20:23   ` SeongJae Park
  3 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2022-05-04 20:10 UTC (permalink / raw)
  To: SeongJae Park; +Cc: akpm, linux-mm, linux-kernel

On Wed, May 04, 2022 at 08:07:55PM +0000, SeongJae Park wrote:
> Several commits on 'mm-unstable' replaces 'PageTransHuge()' with
> 'folio_test_large()' instead of 'folio_test_transhuge()'.  As a result,
> several build errors occur when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.

I sent an entire replacement patch series mere minutes ago which I think
fixes everything you mention here.  Please check?

https://lore.kernel.org/linux-mm/20220504182857.4013401-1-willy@infradead.org/T/#t

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse
  2022-05-04 20:10 ` [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse Matthew Wilcox
@ 2022-05-04 20:23   ` SeongJae Park
  0 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2022-05-04 20:23 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: SeongJae Park, akpm, linux-mm, linux-kernel

On Wed, 4 May 2022 21:10:22 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> On Wed, May 04, 2022 at 08:07:55PM +0000, SeongJae Park wrote:
> > Several commits on 'mm-unstable' replaces 'PageTransHuge()' with
> > 'folio_test_large()' instead of 'folio_test_transhuge()'.  As a result,
> > several build errors occur when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset.
> 
> I sent an entire replacement patch series mere minutes ago which I think
> fixes everything you mention here.  Please check?
> 
> https://lore.kernel.org/linux-mm/20220504182857.4013401-1-willy@infradead.org/T/#t

Thanks for the answer.  Yes, seems the fix has made there :)


Thanks,
SJ

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-04 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 20:07 [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse SeongJae Park
2022-05-04 20:07 ` [PATCH for mm-unstable 1/3] mm/vmscan: Use folio_test_transhuge() for THP check SeongJae Park
2022-05-04 20:07 ` [PATCH for mm-unstable 2/3] mm/shmem: " SeongJae Park
2022-05-04 20:07 ` [PATCH for mm-unstable 3/3] " SeongJae Park
2022-05-04 20:10 ` [PATCH for mm-unstable 0/3] Fix build errors due to folio_test_large() misuse Matthew Wilcox
2022-05-04 20:23   ` SeongJae Park

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.