Skip to contentSkip to conversation

FAILED: patch "[PATCH] vmalloc: fix accounting with i915" failed to apply to 5.10-stable tree

PATCH [email protected] 2 participants 4 messages Dec 23, 2024 – Jan 21, 2025

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x a2e740e216f5bf49ccb83b6d490c72a340558a43
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024122301-uncommon-enquirer-5f71@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From a2e740e216f5bf49ccb83b6d490c72a340558a43 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <[email protected]>
Date: Wed, 11 Dec 2024 20:25:37 +0000
Subject: [PATCH] vmalloc: fix accounting with i915

If the caller of vmap() specifies VM_MAP_PUT_PAGES (currently only the i915 driver), we will decrement nr_vmalloc_pages and MEMCG_VMALLOC in vfree(). These counters are incremented by vmalloc() but not by vmap() so this will cause an underflow. Check the VM_MAP_PUT_PAGES flag before decrementing either counter.

mm/vmalloc.c +4 -2
index f009b21705c1..5c88d0e90c20 100644
@@ -3374,7 +3374,8 @@ void vfree(const void *addr)
 		struct page *page = vm->pages[i];
 
 		BUG_ON(!page);
-		mod_memcg_page_state(page, MEMCG_VMALLOC, -1);
+		if (!(vm->flags & VM_MAP_PUT_PAGES))
+			mod_memcg_page_state(page, MEMCG_VMALLOC, -1);
 		/*
 		 * High-order allocs for huge vmallocs are split, so
 		 * can be freed as an array of order-0 allocations
@@ -3382,7 +3383,8 @@ void vfree(const void *addr)
 		__free_page(page);
 		cond_resched();
 	}
-	atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
+	if (!(vm->flags & VM_MAP_PUT_PAGES))
+		atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
 	kvfree(vm->pages);
 	kfree(vm);
 }
#1 lore raw
Quoted 5 lines · On Mon, Dec 23, 2024 at 11:18:01AM +0100, [email protected] wrote:

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

The 5.15 patch also applies to the 5.10-stable tree. Thanks,

#2 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 5 lines · On Mon, Dec 23, 2024 at 11:18:01AM +0100, [email protected] wrote:

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

The 5.15 patch also applies to the 5.10-stable tree. Thanks,

Seems to have been missed? The 5.15 patch made it into 5.15.176 but the 5.10 patch isn't in 5.10.233 released the same day.

author maintainer
#3 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · On Mon, Dec 23, 2024 at 11:18:01AM +0100, [email protected] wrote:

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 5 lines
Quoted 1 line

The 5.15 patch also applies to the 5.10-stable tree. Thanks,

Seems to have been missed? The 5.15 patch made it into 5.15.176 but the 5.10 patch isn't in 5.10.233 released the same day.

Odd, don't know what happened there, sorry. Now queued up for the next 5.10.y release.

thanks,

greg "drowning in backports" k-h