Skip to contentSkip to conversation

mm/mapping_dirty_helpers: Guard hugepage pud's usage

PATCH Superseded Zack Rusin 2 participants 2 messages Apr 8, 2021 – Apr 9, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zack Rusin

author
#0 lore raw

PATCH 1/1 mm/mapping_dirty_helpers: Guard hugepage pud's usage

Lets make sure we don't use pud hugepage helpers on architectures which do not support it. This fixes the code on arm64.

Cc Andrew Morton <[email protected]>
Cc Thomas Hellström (Intel) <[email protected]>
---
 mm/mapping_dirty_helpers.c | 2 ++
 1 file changed, 2 insertions(+)
mm/mapping_dirty_helpers.c +2 -0
index b59054ef2e10..b890854ec761 100644
@@ -165,10 +165,12 @@ static int wp_clean_pud_entry(pud_t *pud, unsigned long addr, unsigned long end,
 		return 0;
 	}
 
+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
 	/* Huge pud */
 	walk->action = ACTION_CONTINUE;
 	if (pud_trans_huge(pudval) || pud_devmap(pudval))
 		WARN_ON(pud_write(pudval) || pud_dirty(pudval));
+#endif
 
 	return 0;
 }
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Zack Rusin

Lets make sure we don't use pud hugepage helpers on architectures which do not support it. This fixes the code on arm64.

nits:

Perhaps be a little more specific about what it fixes? I figure it's a compilation failure? Also please use imperative form: "Fix the code arm64" rather than "This fixes the code on arm64"

Other than that LGTM.

Quoted 27 lines
Cc Andrew Morton <[email protected]>
Cc Thomas Hellström (Intel) <[email protected]>
---
  mm/mapping_dirty_helpers.c | 2 ++
  1 file changed, 2 insertions(+)
mm/mapping_dirty_helpers.c +2 -0
index b59054ef2e10..b890854ec761 100644
@@ -165,10 +165,12 @@ static int wp_clean_pud_entry(pud_t *pud, unsigned long addr, unsigned long end,
  		return 0;
  	}
 
+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
  	/* Huge pud */
  	walk->action = ACTION_CONTINUE;
  	if (pud_trans_huge(pudval) || pud_devmap(pudval))
  		WARN_ON(pud_write(pudval) || pud_dirty(pudval));
+#endif
 
  	return 0;
  }