[PATCH] mm: delete the unused put_pages_list()

Hugh Dickins posted 1 patch 4 weeks ago
include/linux/mm.h |  2 --
mm/swap.c          | 31 -------------------------------
2 files changed, 33 deletions(-)
[PATCH] mm: delete the unused put_pages_list()
Posted by Hugh Dickins 4 weeks ago
The last user of put_pages_list() converted away from it in 6.10 commit
06c375053cef ("iommu/vt-d: add wrapper functions for page allocations"):
delete put_pages_list().

Signed-off-by: Hugh Dickins <hughd@google.com>
---
 include/linux/mm.h |  2 --
 mm/swap.c          | 31 -------------------------------
 2 files changed, 33 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index ecf63d2b0582..8524bf86dd74 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1286,8 +1286,6 @@ static inline struct folio *virt_to_folio(const void *x)
 
 void __folio_put(struct folio *folio);
 
-void put_pages_list(struct list_head *pages);
-
 void split_page(struct page *page, unsigned int order);
 void folio_copy(struct folio *dst, struct folio *src);
 int folio_mc_copy(struct folio *dst, struct folio *src);
diff --git a/mm/swap.c b/mm/swap.c
index b8e3259ea2c4..638a3f001676 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -127,37 +127,6 @@ void __folio_put(struct folio *folio)
 }
 EXPORT_SYMBOL(__folio_put);
 
-/**
- * put_pages_list() - release a list of pages
- * @pages: list of pages threaded on page->lru
- *
- * Release a list of pages which are strung together on page.lru.
- */
-void put_pages_list(struct list_head *pages)
-{
-	struct folio_batch fbatch;
-	struct folio *folio, *next;
-
-	folio_batch_init(&fbatch);
-	list_for_each_entry_safe(folio, next, pages, lru) {
-		if (!folio_put_testzero(folio))
-			continue;
-		if (folio_test_hugetlb(folio)) {
-			free_huge_folio(folio);
-			continue;
-		}
-		/* LRU flag must be clear because it's passed using the lru */
-		if (folio_batch_add(&fbatch, folio) > 0)
-			continue;
-		free_unref_folios(&fbatch);
-	}
-
-	if (fbatch.nr)
-		free_unref_folios(&fbatch);
-	INIT_LIST_HEAD(pages);
-}
-EXPORT_SYMBOL(put_pages_list);
-
 typedef void (*move_fn_t)(struct lruvec *lruvec, struct folio *folio);
 
 static void lru_add(struct lruvec *lruvec, struct folio *folio)
-- 
2.35.3
Re: [PATCH] mm: delete the unused put_pages_list()
Posted by Yang Shi 3 weeks, 6 days ago
On Sun, Oct 27, 2024 at 1:15 PM Hugh Dickins <hughd@google.com> wrote:
>
> The last user of put_pages_list() converted away from it in 6.10 commit
> 06c375053cef ("iommu/vt-d: add wrapper functions for page allocations"):
> delete put_pages_list().
>
> Signed-off-by: Hugh Dickins <hughd@google.com>

Reviewed-by: Yang Shi <shy828301@gmail.com>

> ---
>  include/linux/mm.h |  2 --
>  mm/swap.c          | 31 -------------------------------
>  2 files changed, 33 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index ecf63d2b0582..8524bf86dd74 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1286,8 +1286,6 @@ static inline struct folio *virt_to_folio(const void *x)
>
>  void __folio_put(struct folio *folio);
>
> -void put_pages_list(struct list_head *pages);
> -
>  void split_page(struct page *page, unsigned int order);
>  void folio_copy(struct folio *dst, struct folio *src);
>  int folio_mc_copy(struct folio *dst, struct folio *src);
> diff --git a/mm/swap.c b/mm/swap.c
> index b8e3259ea2c4..638a3f001676 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -127,37 +127,6 @@ void __folio_put(struct folio *folio)
>  }
>  EXPORT_SYMBOL(__folio_put);
>
> -/**
> - * put_pages_list() - release a list of pages
> - * @pages: list of pages threaded on page->lru
> - *
> - * Release a list of pages which are strung together on page.lru.
> - */
> -void put_pages_list(struct list_head *pages)
> -{
> -       struct folio_batch fbatch;
> -       struct folio *folio, *next;
> -
> -       folio_batch_init(&fbatch);
> -       list_for_each_entry_safe(folio, next, pages, lru) {
> -               if (!folio_put_testzero(folio))
> -                       continue;
> -               if (folio_test_hugetlb(folio)) {
> -                       free_huge_folio(folio);
> -                       continue;
> -               }
> -               /* LRU flag must be clear because it's passed using the lru */
> -               if (folio_batch_add(&fbatch, folio) > 0)
> -                       continue;
> -               free_unref_folios(&fbatch);
> -       }
> -
> -       if (fbatch.nr)
> -               free_unref_folios(&fbatch);
> -       INIT_LIST_HEAD(pages);
> -}
> -EXPORT_SYMBOL(put_pages_list);
> -
>  typedef void (*move_fn_t)(struct lruvec *lruvec, struct folio *folio);
>
>  static void lru_add(struct lruvec *lruvec, struct folio *folio)
> --
> 2.35.3
Re: [PATCH] mm: delete the unused put_pages_list()
Posted by David Hildenbrand 3 weeks, 6 days ago
On 27.10.24 21:14, Hugh Dickins wrote:
> The last user of put_pages_list() converted away from it in 6.10 commit
> 06c375053cef ("iommu/vt-d: add wrapper functions for page allocations"):
> delete put_pages_list().

In that commit we now manually iterate over the list and call put_page() 
on each entry ... I would suspect that to perform worse ;)

In any case, the function surely is unused now.

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb
Re: [PATCH] mm: delete the unused put_pages_list()
Posted by Peter Xu 3 weeks, 6 days ago
On Sun, Oct 27, 2024 at 01:14:42PM -0700, Hugh Dickins wrote:
> The last user of put_pages_list() converted away from it in 6.10 commit
> 06c375053cef ("iommu/vt-d: add wrapper functions for page allocations"):
> delete put_pages_list().
> 
> Signed-off-by: Hugh Dickins <hughd@google.com>

Acked-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu