Skip to contentSkip to conversation

mm/vmpressure: exclude costly-order reclaim from socket pressure accounting

PATCH In review Xueyuan Chen 4 participants 4 messages Nov 27 – Nov 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/vmpressure: exclude costly-order reclaim from socket pressure accounting

vmpressure() accumulates reclaim statistics but only checks the order of the last sample when closing a window. As a result, costly-order reclaim can still trigger socket pressure indirectly or discard accumulated low-order reclaim statistics.

Skip costly-order reclaim before updating the counters.

Fixes f2a950170f7a ("mm/vmpressure: skip socket pressure for costly order reclaim")
---
 mm/vmpressure.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
mm/vmpressure.c +9 -9
index 3de99fef3928..9828a67206ef 100644
@@ -156,6 +156,14 @@ void vmpressure(gfp_t gfp, int order, struct mem_cgroup *memcg, bool tree,
 		if (!memcg || mem_cgroup_is_root(memcg))
 			return;
 
+		/*
+		 * Costly-order reclaim relies on compaction, so its efficiency
+		 * is a poor signal for socket pressure. Exclude these samples
+		 * before they can affect the window.
+		 */
+		if (order > PAGE_ALLOC_COSTLY_ORDER)
+			return;
+
 		spin_lock(&vmpr->sr_lock);
 		scanned = vmpr->scanned += scanned;
 		reclaimed = vmpr->reclaimed += reclaimed;
@@ -168,15 +176,7 @@ void vmpressure(gfp_t gfp, int order, struct mem_cgroup *memcg, bool tree,
 
 		level = vmpressure_calc_level(scanned, reclaimed);
 
-		/*
-		 * Once we go above COSTLY_ORDER, reclaim relies heavily on
-		 * compaction to make progress. Reclaim efficiency was never a
-		 * great proxy for pressure to begin with, but it's outright
-		 * misleading with these high orders. Don't throttle sockets
-		 * because somebody is attempting something crazy like an order-7
-		 * and predictably struggling.
-		 */
-		if (level > VMPRESSURE_LOW && order <= PAGE_ALLOC_COSTLY_ORDER) {
+		if (level > VMPRESSURE_LOW) {
 			/*
 			 * Let the socket buffer allocator know that
 			 * we are having trouble reclaiming LRU pages.

---
base-commit: b95f8bb86713c860ce8536d22a988b949b884d5f

Signature · 2 lines
Best regards,
Xueyuan
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Xueyuan Chen

vmpressure() accumulates reclaim statistics but only checks the order of the last sample when closing a window. As a result, costly-order reclaim can still trigger socket pressure indirectly or discard accumulated low-order reclaim statistics.

Skip costly-order reclaim before updating the counters.

Fixes f2a950170f7a ("mm/vmpressure: skip socket pressure for costly

order reclaim")

Signature · 1 line
All Rights Reversed.
Acked-by on v1 1/1
#2 lore raw
In reply to Xueyuan Chen
Quoted 9 lines · Xueyuan Chen

vmpressure() accumulates reclaim statistics but only checks the order of the last sample when closing a window. As a result, costly-order reclaim can still trigger socket pressure indirectly or discard accumulated low-order reclaim statistics.

Skip costly-order reclaim before updating the counters.

Fixes f2a950170f7a ("mm/vmpressure: skip socket pressure for costly order reclaim")
maintainer tree notice
#3 lore raw

+ mm-vmpressure-exclude-costly-order-reclaim-from-socket-pressure-accounting.patch added to mm-unstable branch

In reply to Xueyuan Chen
The patch titled Subject: mm/vmpressure: exclude costly-order reclaim from socket pressure accounting has been added to the -mm mm-unstable branch. Its filename is…

The patch titled
Subject: mm/vmpressure: exclude costly-order reclaim from socket pressure accounting
has been added to the -mm mm-unstable branch. Its filename is
mm-vmpressure-exclude-costly-order-reclaim-from-socket-pressure-accounting.patch

This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmpressure-exclude-costly-order-reclaim-from-socket-pressure-accounting.patch

This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Xueyuan Chen <[email protected]>
Subject: mm/vmpressure: exclude costly-order reclaim from socket pressure accounting
Date: Fri, 27 Nov 2026 20:27:02 +0800

vmpressure() accumulates reclaim statistics but only checks the order of the last sample when closing a window. As a result, costly-order reclaim can still trigger socket pressure indirectly or discard accumulated low-order reclaim statistics.

Skip costly-order reclaim before updating the counters.

Fixes f2a950170f7a ("mm/vmpressure: skip socket pressure for costly order reclaim")
Cc David Hildenbrand <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Barry Song <[email protected]>
Cc JP Kobryn <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Jakub Kicinski <[email protected]>
 mm/vmpressure.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
mm/vmpressure.c renamed from mm/vmpressure.c~mm-vmpressure-exclude-costly-order-reclaim-from-socket-pressure-accounting +9 -9
@@ -156,6 +156,14 @@ void vmpressure(gfp_t gfp, int order, st
 		if (!memcg || mem_cgroup_is_root(memcg))
 			return;
 
+		/*
+		 * Costly-order reclaim relies on compaction, so its efficiency
+		 * is a poor signal for socket pressure. Exclude these samples
+		 * before they can affect the window.
+		 */
+		if (order > PAGE_ALLOC_COSTLY_ORDER)
+			return;
+
 		spin_lock(&vmpr->sr_lock);
 		scanned = vmpr->scanned += scanned;
 		reclaimed = vmpr->reclaimed += reclaimed;
@@ -168,15 +176,7 @@ void vmpressure(gfp_t gfp, int order, st
 
 		level = vmpressure_calc_level(scanned, reclaimed);
 
-		/*
-		 * Once we go above COSTLY_ORDER, reclaim relies heavily on
-		 * compaction to make progress. Reclaim efficiency was never a
-		 * great proxy for pressure to begin with, but it's outright
-		 * misleading with these high orders. Don't throttle sockets
-		 * because somebody is attempting something crazy like an order-7
-		 * and predictably struggling.
-		 */
-		if (level > VMPRESSURE_LOW && order <= PAGE_ALLOC_COSTLY_ORDER) {
+		if (level > VMPRESSURE_LOW) {
 			/*
 			 * Let the socket buffer allocator know that
 			 * we are having trouble reclaiming LRU pages.

_

Patches currently in -mm which might be from [email protected] are

mm-zsmalloc-remove-config_zsmalloc_stat.patch mm-vmpressure-exclude-costly-order-reclaim-from-socket-pressure-accounting.patch mm-memcontrol-expose-anon-and-file-reclaim-statistics-in-memorystat.patch