* [PATCH 6.1.y 6.6.y] netfilter: nft_set_pipapo: account mapping table allocation
@ 2026-08-31 4:37 Karl Mehltretter
2026-08-31 12:04 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Karl Mehltretter @ 2026-08-31 4:37 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netfilter-devel, coreteam, netdev, linux-kernel,
Bin Lan, XiaoHua Wang, Karl Mehltretter
[ Upstream commit 69e687cea79fc99a17dfb0116c8644b9391b915e ]
The pipapo set backend data structure is one of the ruleset objects
that upstream changed to use GFP_KERNEL_ACCOUNT for memory accounting.
The 6.1.y and 6.6.y adaptations changed the other pipapo allocations,
but omitted the mapping table allocation in pipapo_realloc_mt() because
that helper does not exist in these branches. The equivalent allocation
is in pipapo_resize() and still uses GFP_KERNEL, so the persistent mapping
table is not charged to the allocating memory cgroup.
Update this allocation to use GFP_KERNEL_ACCOUNT.
Fixes: a0bb39980635 ("netfilter: nf_tables: missing objects with no memcg accounting")
Fixes: 1c4f72fa9699 ("netfilter: nf_tables: missing objects with no memcg accounting")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
This patch is based on 6.6.155 and applies unchanged to the tested 6.1.y
tip. The test configurations and full serial logs are retained in the
audit dossier.
A/B tests with a 32,768-element two-field concatenation set left two
262,144-byte mapping tables. The fixed kernels charged approximately
512 KiB more kernel memory to the child cgroup:
6.1.186: +524,288 bytes
6.6.155: +516,096 bytes
The two-page difference on 6.6.y is within memory.stat measurement
variation. Ruleset loading and element lookup succeeded before and after
the change on both branches.
Tested on:
6.1.y d64a499eea6b62b5121beceed9e8a1f57b00d863 (Linux 6.1.186)
6.6.y a4a971135a2ff64382ae4235b3ae60503bb1036a (Linux 6.6.155)
net/netfilter/nft_set_pipapo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 7c8d28a031ad5..8ba76eea3eb18 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -705,7 +705,7 @@ static int pipapo_resize(struct nft_pipapo_field *f, int old_rules, int rules)
return -ENOMEM;
}
- new_mt = kvmalloc(rules * sizeof(*new_mt), GFP_KERNEL);
+ new_mt = kvmalloc(rules * sizeof(*new_mt), GFP_KERNEL_ACCOUNT);
if (!new_mt) {
kvfree(new_lt);
return -ENOMEM;
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 6.1.y 6.6.y] netfilter: nft_set_pipapo: account mapping table allocation
2026-08-31 4:37 [PATCH 6.1.y 6.6.y] netfilter: nft_set_pipapo: account mapping table allocation Karl Mehltretter
@ 2026-08-31 12:04 ` Greg Kroah-Hartman
2026-08-31 18:07 ` [PATCH 6.1.y 6.6.y v2] netfilter: nf_tables: missing objects with no memcg accounting Karl Mehltretter
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-31 12:04 UTC (permalink / raw)
To: Karl Mehltretter
Cc: stable, Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netfilter-devel, coreteam, netdev, linux-kernel, Bin Lan,
XiaoHua Wang
On Mon, Aug 31, 2026 at 06:37:55AM +0200, Karl Mehltretter wrote:
> [ Upstream commit 69e687cea79fc99a17dfb0116c8644b9391b915e ]
>
> The pipapo set backend data structure is one of the ruleset objects
> that upstream changed to use GFP_KERNEL_ACCOUNT for memory accounting.
>
> The 6.1.y and 6.6.y adaptations changed the other pipapo allocations,
> but omitted the mapping table allocation in pipapo_realloc_mt() because
> that helper does not exist in these branches. The equivalent allocation
> is in pipapo_resize() and still uses GFP_KERNEL, so the persistent mapping
> table is not charged to the allocating memory cgroup.
>
> Update this allocation to use GFP_KERNEL_ACCOUNT.
>
> Fixes: a0bb39980635 ("netfilter: nf_tables: missing objects with no memcg accounting")
> Fixes: 1c4f72fa9699 ("netfilter: nf_tables: missing objects with no memcg accounting")
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
You lost the original authorship and signed-off-by :(
And it is very different from the original.
Also, why is this needed at all?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 6.1.y 6.6.y v2] netfilter: nf_tables: missing objects with no memcg accounting
2026-08-31 12:04 ` Greg Kroah-Hartman
@ 2026-08-31 18:07 ` Karl Mehltretter
0 siblings, 0 replies; 3+ messages in thread
From: Karl Mehltretter @ 2026-08-31 18:07 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Pablo Neira Ayuso, Florian Westphal,
Phil Sutter, Jozsef Kadlecsik, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Vasily Averin, Bin Lan,
XiaoHua Wang, netfilter-devel, coreteam, netdev, linux-kernel
From: Pablo Neira Ayuso <pablo@netfilter.org>
[ Upstream commit 69e687cea79fc99a17dfb0116c8644b9391b915e ]
Several ruleset objects are still not using GFP_KERNEL_ACCOUNT for
memory accounting, update them. This includes:
- catchall elements
- compat match large info area
- log prefix
- meta secctx
- numgen counters
- pipapo set backend datastructure
- tunnel private objects
Fixes: 33758c891479 ("memcg: enable accounting for nft objects")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ Karl Mehltretter: The original 6.1.y and 6.6.y backports omitted the
pipapo_realloc_mt() hunk. In these pre-refactor trees, the corresponding
mapping-table allocation is still part of pipapo_resize() and uses
GFP_KERNEL. A/B tests on 6.1.186 and 6.6.155 measured 524,288 additional
charged bytes for a 32,768-element two-field set. On 6.12.107, the
corresponding allocation was already accounted. ]
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
Changes in v2:
- restore Pablo's authorship, original changelog, Fixes tag and sign-off
- document the older-tree adaptation and exact A/B accounting result
v1: https://lore.kernel.org/stable/20260831043755.29692-1-kmehltretter@gmail.com/
net/netfilter/nft_set_pipapo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 7c8d28a031ad..8ba76eea3eb1 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -705,7 +705,7 @@ static int pipapo_resize(struct nft_pipapo_field *f, int old_rules, int rules)
return -ENOMEM;
}
- new_mt = kvmalloc(rules * sizeof(*new_mt), GFP_KERNEL);
+ new_mt = kvmalloc(rules * sizeof(*new_mt), GFP_KERNEL_ACCOUNT);
if (!new_mt) {
kvfree(new_lt);
return -ENOMEM;
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-31 18:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 4:37 [PATCH 6.1.y 6.6.y] netfilter: nft_set_pipapo: account mapping table allocation Karl Mehltretter
2026-08-31 12:04 ` Greg Kroah-Hartman
2026-08-31 18:07 ` [PATCH 6.1.y 6.6.y v2] netfilter: nf_tables: missing objects with no memcg accounting Karl Mehltretter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.