[PATCH 14/25] mm/fbatch: no lru_add_drain() nor _all() for memfd_wait_for_pins()

From: Hugh Dickins

Date: Mon Aug 24 2026 - 10:31:44 EST


memfd_tag_pins() used lru_add_drain(), memfd_wait_for_pins() then used
lru_add_drain_all(): remove those calls, no longer useful now that the
per-cpu fbatch references are gone.

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
mm/memfd.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/memfd.c b/mm/memfd.c
index c708d92533f4..064f24dcddaa 100644
--- a/mm/memfd.c
+++ b/mm/memfd.c
@@ -40,8 +40,6 @@ static void memfd_tag_pins(struct xa_state *xas)
struct folio *folio;
int latency = 0;

- lru_add_drain();
-
xas_lock_irq(xas);
xas_for_each(xas, folio, ULONG_MAX) {
if (!xa_is_value(folio) && memfd_folio_has_extra_refs(folio))
@@ -168,9 +166,7 @@ static int memfd_wait_for_pins(struct address_space *mapping)
if (!xas_marked(&xas, MEMFD_TAG_PINNED))
break;

- if (!scan)
- lru_add_drain_all();
- else if (schedule_timeout_killable((HZ << scan) / 200))
+ if (scan && schedule_timeout_killable((HZ << scan) / 200))
scan = LAST_SCAN;

xas_set(&xas, 0);
--
2.51.0