Skip to contentSkip to conversation

fork-check-charging-success-before-zeroing-stack.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 21, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: fork: check charging success before zeroing stack
has been removed from the -mm tree. Its filename was
fork-check-charging-success-before-zeroing-stack.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: Pasha Tatashin <[email protected]>
Subject: fork: check charging success before zeroing stack
Date: Fri, 29 Aug 2025 13:44:40 +0200

Patch series "mm: task_stack: Stack handling cleanups".

These are some small cleanups for the fork code that was split off from Pasha:s dynamic stack patch series, they are generally nice on their own so let's propose them for merging.

This patch (of 2):

No need to do zero cached stack if memcg charge fails, so move the charging attempt before the memset operation.

---

 kernel/fork.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/fork.c renamed from kernel/fork.c~fork-check-charging-success-before-zeroing-stack +5 -5
@@ -290,6 +290,11 @@ static int alloc_thread_stack_node(struc
 		if (!vm_area)
 			continue;
 
+		if (memcg_charge_kernel_stack(vm_area)) {
+			vfree(vm_area->addr);
+			return -ENOMEM;
+		}
+
 		/* Reset stack metadata. */
 		kasan_unpoison_range(vm_area->addr, THREAD_SIZE);
 
@@ -298,11 +303,6 @@ static int alloc_thread_stack_node(struc
 		/* Clear stale pointers from reused stack. */
 		memset(stack, 0, THREAD_SIZE);
 
-		if (memcg_charge_kernel_stack(vm_area)) {
-			vfree(vm_area->addr);
-			return -ENOMEM;
-		}
-
 		tsk->stack_vm_area = vm_area;
 		tsk->stack = stack;
 		return 0;

_

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