Re: [PATCH] mm: hugetlb_vmemmap: remove redundant list_del()

From: Mike Kravetz
Date: Thu Oct 27 2022 - 14:53:34 EST


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@xxxxxxxxxxxxx>
> ---
> mm/hugetlb_vmemmap.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

Thanks,

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

>
> 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,
> --
> 2.11.0
>