linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Usama Arif <usamaarif642@gmail.com>
To: akpm@linux-foundation.org, linux-mm@kvack.org
Cc: hannes@cmpxchg.org, riel@surriel.com, shakeel.butt@linux.dev,
	roman.gushchin@linux.dev, yuzhao@google.com, david@redhat.com,
	baohua@kernel.org, ryan.roberts@arm.com, rppt@kernel.org,
	willy@infradead.org, cerasuolodomenico@gmail.com, corbet@lwn.net,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	kernel-team@meta.com, Usama Arif <usamaarif642@gmail.com>
Subject: [PATCH 2/6] Revert "mm: remove free_unref_page_list()"
Date: Tue, 30 Jul 2024 13:45:59 +0100	[thread overview]
Message-ID: <20240730125346.1580150-3-usamaarif642@gmail.com> (raw)
In-Reply-To: <20240730125346.1580150-1-usamaarif642@gmail.com>

free_unref_page_list will be needed in a later patch for an
optimization to free zapped tail pages when splitting isolated thp.

Signed-off-by: Usama Arif <usamaarif642@gmail.com>
---
 mm/internal.h   |  1 +
 mm/page_alloc.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/mm/internal.h b/mm/internal.h
index 7a3bcc6d95e7..259afe44dc88 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -680,6 +680,7 @@ extern int user_min_free_kbytes;
 
 void free_unref_page(struct page *page, unsigned int order);
 void free_unref_folios(struct folio_batch *fbatch);
+void free_unref_page_list(struct list_head *list);
 
 extern void zone_pcp_reset(struct zone *zone);
 extern void zone_pcp_disable(struct zone *zone);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index aae00ba3b3bd..38832e6b1e6c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2774,6 +2774,24 @@ void free_unref_folios(struct folio_batch *folios)
 	folio_batch_reinit(folios);
 }
 
+void free_unref_page_list(struct list_head *list)
+{
+	struct folio_batch fbatch;
+
+	folio_batch_init(&fbatch);
+	while (!list_empty(list)) {
+		struct folio *folio = list_first_entry(list, struct folio, lru);
+
+		list_del(&folio->lru);
+		if (folio_batch_add(&fbatch, folio) > 0)
+			continue;
+		free_unref_folios(&fbatch);
+	}
+
+	if (fbatch.nr)
+		free_unref_folios(&fbatch);
+}
+
 /*
  * split_page takes a non-compound higher-order page, and splits it into
  * n (1<<order) sub-pages: page[0..n]
-- 
2.43.0



  parent reply	other threads:[~2024-07-30 12:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 12:45 [PATCH 0/6] mm: split underutilized THPs Usama Arif
2024-07-30 12:45 ` [PATCH 1/6] Revert "memcg: remove mem_cgroup_uncharge_list()" Usama Arif
2024-07-30 12:45 ` Usama Arif [this message]
2024-07-30 12:46 ` [PATCH 3/6] mm: free zapped tail pages when splitting isolated thp Usama Arif
2024-07-30 15:14   ` David Hildenbrand
2024-08-04 19:02     ` Usama Arif
2024-08-05  9:00       ` David Hildenbrand
2024-08-06  9:58         ` Usama Arif
2024-07-30 12:46 ` [PATCH 4/6] mm: don't remap unused subpages " Usama Arif
2024-07-30 18:07   ` Rik van Riel
2024-07-31 17:08     ` Usama Arif
2024-07-30 12:46 ` [PATCH 5/6] mm: add selftests to split_huge_page() to verify unmap/zap of zero pages Usama Arif
2024-07-30 18:10   ` Rik van Riel
2024-08-01  4:45   ` kernel test robot
2024-07-30 12:46 ` [PATCH 6/6] mm: split underutilized THPs Usama Arif
2024-07-30 13:59   ` Randy Dunlap
2024-07-30 14:35 ` [PATCH 0/6] " David Hildenbrand
2024-07-30 15:14   ` Usama Arif
2024-07-30 15:19     ` Usama Arif
2024-07-30 16:11       ` David Hildenbrand
2024-07-30 17:22         ` Usama Arif
2024-07-30 20:25           ` David Hildenbrand
2024-07-31 17:01             ` Usama Arif
2024-07-31 17:51               ` David Hildenbrand
2024-07-31 20:41                 ` Usama Arif
2024-08-01  6:36                   ` David Hildenbrand
2024-08-04 23:04                     ` Usama Arif
     [not found]                     ` <20240806172830.GD322282@cmpxchg.org>
2024-08-06 17:33                       ` David Hildenbrand
2024-08-01  6:09 ` Yu Zhao
2024-08-01 15:47   ` David Hildenbrand
2024-08-04 21:54     ` Yu Zhao
2024-08-05  1:32       ` Rik van Riel
2024-08-05 19:51         ` Yu Zhao
2024-08-01 16:22   ` Usama Arif
2024-08-01 16:27     ` David Hildenbrand
2024-08-04 19:10       ` Usama Arif
2024-08-04 23:32       ` Yu Zhao
2024-08-04 23:23     ` Yu Zhao
2024-08-06 11:18       ` Usama Arif
2024-08-06 17:38   ` Johannes Weiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240730125346.1580150-3-usamaarif642@gmail.com \
    --to=usamaarif642@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@surriel.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).