[merged mm-stable] mm-lruvec-trace-lru-add-drains-and-drain-all-requests.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 28 Jul 2026 21:13:03 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm/lruvec: trace LRU add drains and drain-all requests
has been removed from the -mm tree. Its filename was
mm-lruvec-trace-lru-add-drains-and-drain-all-requests.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: JP Kobryn <[email protected]>
Subject: mm/lruvec: trace LRU add drains and drain-all requests
Date: Mon, 22 Jun 2026 11:51:27 -0700
LRU add batches can be drained before they reach capacity. This can be a
source of LRU lock contention, but it is not currently possible to
attribute these drains to callers with existing tracepoints.
Add mm_lru_add_drain to report the CPU and lru_add batch count when an
lru_add batch is drained. This allows tracing to distinguish full drains
from partial drains and attribute them to the calling stack.
Add mm_lru_add_drain_all to capture callers of __lru_add_drain_all and
whether they set the force flag for all CPUs. The tracepoint resembles
the signature of the enclosing function, but is needed because of
potential inlining.
Note that DECLARE_TRACE() is used for these new trace hooks to avoid
creating a new trace event ABI.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: JP Kobryn <[email protected]>
Reviewed-by: Barry Song <[email protected]>
Acked-by: Shakeel Butt <[email protected]>
Cc: Axel Rasmussen <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Kairui Song <[email protected]>
Cc: Kemeng Shi <[email protected]>
Cc: "Masami Hiramatsu (Google)" <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Nhat Pham <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Yuanchu Xie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
include/trace/events/pagemap.h | 8 ++++++++
mm/swap.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
--- a/include/trace/events/pagemap.h~mm-lruvec-trace-lru-add-drains-and-drain-all-requests
+++ a/include/trace/events/pagemap.h
@@ -77,6 +77,14 @@ TRACE_EVENT(mm_lru_activate,
TP_printk("folio=%p pfn=0x%lx", __entry->folio, __entry->pfn)
);
+DECLARE_TRACE(mm_lru_add_drain,
+ TP_PROTO(int cpu, unsigned int nr_folios),
+ TP_ARGS(cpu, nr_folios));
+
+DECLARE_TRACE(mm_lru_add_drain_all,
+ TP_PROTO(bool force_all_cpus),
+ TP_ARGS(force_all_cpus));
+
#endif /* _TRACE_PAGEMAP_H */
/* This part must be outside protection */
--- a/mm/swap.c~mm-lruvec-trace-lru-add-drains-and-drain-all-requests
+++ a/mm/swap.c
@@ -694,9 +694,12 @@ void lru_add_drain_cpu(int cpu)
{
struct cpu_fbatches *fbatches = &per_cpu(cpu_fbatches, cpu);
struct folio_batch *fbatch = &fbatches->lru_add;
+ unsigned int nr_folios = folio_batch_count(fbatch);
- if (folio_batch_count(fbatch))
+ if (nr_folios) {
folio_batch_move_lru(fbatch, lru_add);
+ trace_mm_lru_add_drain_tp(cpu, nr_folios);
+ }
fbatch = &fbatches->lru_move_tail;
/* Disabling interrupts below acts as a compiler barrier. */
@@ -869,6 +872,8 @@ static inline void __lru_add_drain_all(b
if (WARN_ON(!mm_percpu_wq))
return;
+ trace_mm_lru_add_drain_all_tp(force_all_cpus);
+
/*
* Guarantee folio_batch counter stores visible by this CPU
* are visible to other CPUs before loading the current drain
_
Patches currently in -mm which might be from [email protected] are
mm-page_alloc-use-existing-highatomic-reserves-on-the-buddy-fastpath.patch