lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33389bf8-f79d-d4dd-b7a4-680c4aa21b23@google.com>
Date: Mon, 8 Sep 2025 15:24:54 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Alexander Krabler <Alexander.Krabler@...a.com>, 
    "Aneesh Kumar K.V" <aneesh.kumar@...nel.org>, 
    Axel Rasmussen <axelrasmussen@...gle.com>, Chris Li <chrisl@...nel.org>, 
    Christoph Hellwig <hch@...radead.org>, 
    David Hildenbrand <david@...hat.com>, Frederick Mayle <fmayle@...gle.com>, 
    Jason Gunthorpe <jgg@...pe.ca>, Johannes Weiner <hannes@...xchg.org>, 
    John Hubbard <jhubbard@...dia.com>, Keir Fraser <keirf@...gle.com>, 
    Konstantin Khlebnikov <koct9i@...il.com>, Li Zhe <lizhe.67@...edance.com>, 
    Matthew Wilcox <willy@...radead.org>, Peter Xu <peterx@...hat.com>, 
    Rik van Riel <riel@...riel.com>, Shivank Garg <shivankg@....com>, 
    Vlastimil Babka <vbabka@...e.cz>, Wei Xu <weixugc@...gle.com>, 
    Will Deacon <will@...nel.org>, yangge <yangge1116@....com>, 
    Yuanchu Xie <yuanchu@...gle.com>, Yu Zhao <yuzhao@...gle.com>, 
    linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: [PATCH v2 6/6] mm: lru_add_drain_all() do local lru_add_drain()
 first

No numbers to back this up, but it seemed obvious to me, that if there
are competing lru_add_drain_all()ers, the work will be minimized if each
flushes its own local queues before locking and doing cross-CPU drains.

Signed-off-by: Hugh Dickins <hughd@...gle.com>
Acked-by: David Hildenbrand <david@...hat.com>
---
 mm/swap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/swap.c b/mm/swap.c
index b74ebe865dd9..881e53b2877e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -834,6 +834,9 @@ static inline void __lru_add_drain_all(bool force_all_cpus)
 	 */
 	this_gen = smp_load_acquire(&lru_drain_gen);
 
+	/* It helps everyone if we do our own local drain immediately. */
+	lru_add_drain();
+
 	mutex_lock(&lock);
 
 	/*
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ