mm: hugetlb_vmemmap: remove redundant list_del()

Message ID 20221027033641.66709-1-songmuchun@bytedance.com
State New
Headers
Series mm: hugetlb_vmemmap: remove redundant list_del() |

Commit Message

Muchun Song Oct. 27, 2022, 3:36 a.m. UTC
  The ->lru field will be assigned to a new value in __free_page().
So it is unnecessary to delete it from the @list.  Just remove it
to simplify the code.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/hugetlb_vmemmap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Mike Kravetz Oct. 27, 2022, 6:53 p.m. UTC | #1
On 10/27/22 11:36, Muchun Song wrote:
> The ->lru field will be assigned to a new value in __free_page().
> So it is unnecessary to delete it from the @list.  Just remove it
> to simplify the code.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  mm/hugetlb_vmemmap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Thanks,

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
  

Patch

diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 20f414c0379f..c98805d5b815 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -231,10 +231,8 @@  static void free_vmemmap_page_list(struct list_head *list)
 {
 	struct page *page, *next;
 
-	list_for_each_entry_safe(page, next, list, lru) {
-		list_del(&page->lru);
+	list_for_each_entry_safe(page, next, list, lru)
 		free_vmemmap_page(page);
-	}
 }
 
 static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,