Skip to contentSkip to conversation

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

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 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-nonmm-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, 09 May 2025 08:29:28 +0200

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
@@ -280,6 +280,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);
 
@@ -288,11 +293,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