Skip to contentSkip to conversation

proc: Avoid unused variable warning in pagemap_pmd_range()

PATCH New Nathan Chancellor 1 participant 1 message Feb 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: Avoid unused variable warning in pagemap_pmd_range()

When building with CONFIG_TRANSPARENT_HUGEPAGE=n, there is a warning about migration being unused:

  fs/proc/task_mmu.c:1444:7: warning: unused variable 'migration' [-Wunused-variable]
          bool migration = false;
               ^
  1 warning generated.

Move the ifdef preprocessor directive up to include migration so it is only included in the file when it is used.

---

This is a fix for fs-proc-task_mmuc-dont-read-mapcount-for-migration-entry-v4.patch.

 fs/proc/task_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/task_mmu.c +1 -1
index bc2f46033231..6e97ed775074 100644
@@ -1441,9 +1441,9 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
 	spinlock_t *ptl;
 	pte_t *pte, *orig_pte;
 	int err = 0;
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	bool migration = false;
 
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	ptl = pmd_trans_huge_lock(pmdp, vma);
 	if (ptl) {
 		u64 flags = 0, frame = 0;

base-commit: b3c0a155ef77550d48f6eb7c6fdd6075764a5622

Signature · 1 line
2.35.1