FAILED: patch "[PATCH] ipmr: account multicast table and route memory" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-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-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x b7ee18725f2292ab554aa96a101ae42d45f008bd
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026091603-unstuffed-goes-e540@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b7ee18725f2292ab554aa96a101ae42d45f008bd Mon Sep 17 00:00:00 2001
From: Zihan Xi <[email protected]>
Date: Tue, 8 Sep 2026 11:58:39 +0000
Subject: [PATCH] ipmr: account multicast table and route memory
A netadmin in a user+net namespace can create many IPv4 and IPv6 multicast routing tables with MRT_TABLE and MRT6_TABLE. Each unseen id allocates an mr_table via the shared mr_table_alloc(), links it into the per-net list, and leaves it until netns teardown. Those objects were not charged to memcg, so the host unreclaimable slab grows with the table count.
Account mr_table allocations with GFP_KERNEL_ACCOUNT and mark the IPv4/IPv6 MFC caches SLAB_ACCOUNT. This matches the established handling of IP addresses, routes and alternate interface names.
Unresolved MFC entries are still allocated from softIRQ with GFP_ATOMIC and are not charged. They expire after 10 seconds and are bounded by the socket receive queue; see commit 0079ad8e8dc3 ("ipmr: remove hard code cache_resolve_queue_len limit").
net/ipv4/ipmr.c +2 -1
@@ -3376,7 +3376,8 @@ int __init ip_mr_init(void) {int err; - mrt_cachep =KMEM_CACHE (mfc_cache,SLAB_HWCACHE_ALIGN |SLAB_PANIC ); + mrt_cachep =KMEM_CACHE (mfc_cache, +SLAB_HWCACHE_ALIGN |SLAB_PANIC |SLAB_ACCOUNT ); err =register_pernet_subsys (&ipmr_net_ops);if (err)
net/ipv4/ipmr_base.c +1 -1
@@ -52,7 +52,7 @@ mr_table_alloc(struct net *net, u32 id,struct mr_table *mrt;int err; - mrt =kzalloc_obj (*mrt); + mrt =kzalloc_obj (*mrt,GFP_KERNEL_ACCOUNT );if (!mrt)return ERR_PTR (-ENOMEM ); mrt->id = id;
net/ipv6/ip6mr.c +1 -1
@@ -1427,7 +1427,7 @@ int __init ip6_mr_init(void) {int err; - mrt_cachep =KMEM_CACHE (mfc6_cache,SLAB_HWCACHE_ALIGN ); + mrt_cachep =KMEM_CACHE (mfc6_cache,SLAB_HWCACHE_ALIGN |SLAB_ACCOUNT );if (!mrt_cachep)return -ENOMEM ;
Sasha Levin
maintainerPATCH 1/1 ipmr: account multicast table and route memory
From: Zihan Xi <[email protected]>
[ Upstream commit b7ee18725f2292ab554aa96a101ae42d45f008bd ]
A netadmin in a user+net namespace can create many IPv4 and IPv6 multicast routing tables with MRT_TABLE and MRT6_TABLE. Each unseen id allocates an mr_table via the shared mr_table_alloc(), links it into the per-net list, and leaves it until netns teardown. Those objects were not charged to memcg, so the host unreclaimable slab grows with the table count.
Account mr_table allocations with GFP_KERNEL_ACCOUNT and mark the IPv4/IPv6 MFC caches SLAB_ACCOUNT. This matches the established handling of IP addresses, routes and alternate interface names.
Unresolved MFC entries are still allocated from softIRQ with GFP_ATOMIC and are not charged. They expire after 10 seconds and are bounded by the socket receive queue; see commit 0079ad8e8dc3 ("ipmr: remove hard code cache_resolve_queue_len limit").
--- net/ipv4/ipmr.c | 3 ++- net/ipv4/ipmr_base.c | 2 +- net/ipv6/ip6mr.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
net/ipv4/ipmr.c +2 -1
@@ -3159,7 +3159,8 @@ int __init ip_mr_init(void) {int err; - mrt_cachep =KMEM_CACHE (mfc_cache,SLAB_HWCACHE_ALIGN |SLAB_PANIC ); + mrt_cachep =KMEM_CACHE (mfc_cache, +SLAB_HWCACHE_ALIGN |SLAB_PANIC |SLAB_ACCOUNT ); err =register_pernet_subsys (&ipmr_net_ops);if (err)
net/ipv4/ipmr_base.c +1 -1
@@ -38,7 +38,7 @@ mr_table_alloc(struct net *net, u32 id,struct mr_table *mrt;int err; - mrt =kzalloc (sizeof (*mrt),GFP_KERNEL ); + mrt =kzalloc (sizeof (*mrt),GFP_KERNEL_ACCOUNT );if (!mrt)return ERR_PTR (-ENOMEM ); mrt->id = id;
net/ipv6/ip6mr.c +1 -1
@@ -1387,7 +1387,7 @@ int __init ip6_mr_init(void) {int err; - mrt_cachep =KMEM_CACHE (mfc6_cache,SLAB_HWCACHE_ALIGN ); + mrt_cachep =KMEM_CACHE (mfc6_cache,SLAB_HWCACHE_ALIGN |SLAB_ACCOUNT );if (!mrt_cachep)return -ENOMEM ;
Signature · 1 line
2.53.0