Skip to contentSkip to conversation

mm/huge_memory.c: Remove unused variable unmap_success

PATCH In review Souptick Joarder 3 participants 4 messages May 18, 2021 – May 25, 2021

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

PATCH 1/1 mm/huge_memory.c: Remove unused variable unmap_success

Kernel test robot throws below warning ->

mm/huge_memory.c: In function 'unmap_page':

Quoted 1 line
Quoted 1 line

mm/huge_memory.c:2345:7: warning: variable 'unmap_success' set but not used [-Wunused-but-set-variable]

    2345 |  bool unmap_success;
         |       ^~~~~~~~~~~~~

Remove the unused variable unmap_success.

---
 mm/huge_memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/huge_memory.c +1 -2
index 52ca04b905cf..ff79a12993c9 100644
@@ -2342,14 +2342,13 @@ static void unmap_page(struct page *page)
 {
 	enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK |
 		TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
-	bool unmap_success;
 
 	VM_BUG_ON_PAGE(!PageHead(page), page);
 
 	if (PageAnon(page))
 		ttu_flags |= TTU_SPLIT_FREEZE;
 
-	unmap_success = try_to_unmap(page, ttu_flags);
+	try_to_unmap(page, ttu_flags);
 }
 
 static void remap_page(struct page *page, unsigned int nr)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Souptick Joarder

Kernel test robot throws below warning ->

mm/huge_memory.c: In function 'unmap_page':

Quoted 8 lines
Quoted 1 line
Quoted 1 line

mm/huge_memory.c:2345:7: warning: variable 'unmap_success' set but not used [-Wunused-but-set-variable]

    2345 |  bool unmap_success;
         |       ^~~~~~~~~~~~~

Remove the unused variable unmap_success.

Thanks for catching this. Reviewed-by: Yang Shi <[email protected]>

Just like https://lore.kernel.org/linux-mm/CAHbLzkonsd9f=48+cxKOJamNb9e8qpvWJCYDGFB_wNTdET2zmQ@mail.gmail.com/T/#t,
not sure why my compiler didn't catch such warning.

Quoted 28 lines
---
 mm/huge_memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/huge_memory.c +1 -3
index 52ca04b905cf..ff79a12993c9 100644
@@ -2342,14 +2342,13 @@ static void unmap_page(struct page *page)
 {
        enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK |
                TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
-       bool unmap_success;
 
        VM_BUG_ON_PAGE(!PageHead(page), page);
 
        if (PageAnon(page))
                ttu_flags |= TTU_SPLIT_FREEZE;
 
-       unmap_success = try_to_unmap(page, ttu_flags);
+       try_to_unmap(page, ttu_flags);
 }
 
 static void remap_page(struct page *page, unsigned int nr)
--

2.25.1

#2 lore raw
Quoted 12 lines · Yang Shi
Quoted 10 lines · Souptick Joarder

Kernel test robot throws below warning ->

mm/huge_memory.c: In function 'unmap_page':

Quoted 1 line
Quoted 1 line

mm/huge_memory.c:2345:7: warning: variable 'unmap_success' set but not used [-Wunused-but-set-variable]

    2345 |  bool unmap_success;
         |       ^~~~~~~~~~~~~

Remove the unused variable unmap_success.

Quoted 7 lines
Quoted 2 lines

Thanks for catching this. Reviewed-by: Yang Shi <[email protected]>

Just like https://lore.kernel.org/linux-mm/CAHbLzkonsd9f=48+cxKOJamNb9e8qpvWJCYDGFB_wNTdET2zmQ@mail.gmail.com/T/#t,
not sure why my compiler didn't catch such warning.

I just found out my build has "-Wno-unused-but-set-variable". This explains why I didn't catch it.

Quoted 28 lines
Quoted 28 lines
---
 mm/huge_memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/huge_memory.c +1 -3
index 52ca04b905cf..ff79a12993c9 100644
@@ -2342,14 +2342,13 @@ static void unmap_page(struct page *page)
 {
        enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK |
                TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
-       bool unmap_success;
 
        VM_BUG_ON_PAGE(!PageHead(page), page);
 
        if (PageAnon(page))
                ttu_flags |= TTU_SPLIT_FREEZE;
 
-       unmap_success = try_to_unmap(page, ttu_flags);
+       try_to_unmap(page, ttu_flags);
 }
 
 static void remap_page(struct page *page, unsigned int nr)
--

2.25.1

Reviewed-by on v1 1/1
#3 lore raw
In reply to Souptick Joarder
Quoted 26 lines · Souptick Joarder

Kernel test robot throws below warning ->

mm/huge_memory.c: In function 'unmap_page':

Quoted 1 line
Quoted 1 line

mm/huge_memory.c:2345:7: warning: variable 'unmap_success' set but not used [-Wunused-but-set-variable]

     2345 |  bool unmap_success;
          |       ^~~~~~~~~~~~~

Remove the unused variable unmap_success.

---
  mm/huge_memory.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
mm/huge_memory.c +0 -1
index 52ca04b905cf..ff79a12993c9 100644
@@ -2342,14 +2342,13 @@ static void unmap_page(struct page *page)
  {
  	enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK |
  		TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
-	bool unmap_success;
 

mm/huge_memory.c static void unmap_page(struct page *page) · line 2354

Quoted 10 lines
mm/huge_memory.c +1 -1
  	VM_BUG_ON_PAGE(!PageHead(page), page);
 
  	if (PageAnon(page))
  		ttu_flags |= TTU_SPLIT_FREEZE;
 
-	unmap_success = try_to_unmap(page, ttu_flags);
+	try_to_unmap(page, ttu_flags);
  }
 
  static void remap_page(struct page *page, unsigned int nr)
Signature · 3 lines
Thanks,

David / dhildenb