net/sched: refine fq_codel memory limits
Subsystems (6)
cover net/sched: refine fq_codel memory limits
Packets that are associated with local sockets sk_wmem_alloc do not really need additional memory control.
First patch makes is_skb_wmem() available to modules.
Second patch uses is_skb_wmem() in fq_codel.
Eric Dumazet (2):
net: make is_skb_wmem() available to modules net/sched: fq_codel: local packets no longer count against memory
limit
include/net/sock.h | 12 +++++++++++- include/net/tcp.h | 1 - net/core/skbuff.c | 2 +- net/core/sock.c | 3 +++ net/core/sock_destructor.h | 12 ------------ net/ipv4/inet_fragment.c | 2 -- net/ipv4/tcp_output.c | 1 + net/sched/sch_fq_codel.c | 2 +- 8 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 net/core/sock_destructor.h
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
PATCH 1/2 net: make is_skb_wmem() available to modules
Following patch will use is_skb_wmem() from fq_codel.
Provide __sock_wfree() only if CONFIG_INET=y
--- include/net/sock.h | 12 +++++++++++- include/net/tcp.h | 1 - net/core/skbuff.c | 2 +- net/core/sock.c | 3 +++ net/core/sock_destructor.h | 12 ------------ net/ipv4/inet_fragment.c | 2 -- net/ipv4/tcp_output.c | 1 + 7 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 net/core/sock_destructor.h
include/net/sock.h +11 -1
@@ -1850,8 +1850,18 @@ static inline struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priostruct sk_buff *sock_wmalloc (struct sock *sk,unsigned long size,int force,gfp_t priority); -void __sock_wfree (struct sk_buff *skb);void sock_wfree (struct sk_buff *skb); +#ifdef CONFIG_INET +void __sock_wfree (struct sk_buff *skb); +void tcp_wfree (struct sk_buff *skb); +#endif +static inline bool is_skb_wmem (const struct sk_buff *skb) +{ +return skb->destructor == sock_wfree || + (IS_ENABLED (CONFIG_INET ) && skb->destructor == __sock_wfree) || + (IS_ENABLED (CONFIG_INET ) && skb->destructor == tcp_wfree); +} +struct sk_buff *sock_omalloc (struct sock *sk,unsigned long size,gfp_t priority);void skb_orphan_partial (struct sk_buff *skb);
include/net/tcp.h +0 -1
@@ -390,7 +390,6 @@ static inline bool tcp_release_cb_cond(struct sock *sk)return false; } -void tcp_wfree (struct sk_buff *skb);void tcp_write_timer_handler (struct sock *sk);void tcp_delack_timer_handler (struct sock *sk);int tcp_ioctl (struct sock *sk,int cmd,int *karg);
net/core/skbuff.c +1 -1
@@ -78,6 +78,7 @@#include <net/mpls.h> #include <net/mptcp.h> #include <net/mctp.h> +#include <net/tcp.h> #include <net/can.h> #include <net/page_pool/helpers.h> #include <net/psp/types.h>
@@ -96,7 +97,6 @@#include "devmem.h" #include "net-sysfs.h" #include "netmem_priv.h" -#include "sock_destructor.h" #ifdef CONFIG_SKB_EXTENSIONS static struct kmem_cache *skbuff_ext_cache__ro_after_init ;
net/core/sock.c +3 -0
@@ -2708,6 +2708,7 @@ EXPORT_SYMBOL(sock_wfree);/* This variant of sock_wfree() is used by TCP, * since it sets SOCK_USE_WRITE_QUEUE. */ +#ifdef CONFIG_INET void __sock_wfree (struct sk_buff *skb) {struct sock *sk = skb->sk;
@@ -2715,6 +2716,8 @@ void __sock_wfree(struct sk_buff *skb)if (refcount_sub_and_test (skb->truesize, &sk->sk_wmem_alloc)) __sk_free(sk); } +EXPORT_SYMBOL_GPL (__sock_wfree); +#endif void skb_set_owner_w (struct sk_buff *skb,struct sock *sk) {
net/core/sock_destructor.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _NET_CORE_SOCK_DESTRUCTOR_H -#define _NET_CORE_SOCK_DESTRUCTOR_H -#include <net/tcp.h> - -static inline bool is_skb_wmem (const struct sk_buff *skb) -{ -return skb->destructor == sock_wfree || - skb->destructor == __sock_wfree || - (IS_ENABLED (CONFIG_INET ) && skb->destructor == tcp_wfree); -} -#endif
net/ipv4/inet_fragment.c +0 -2
@@ -24,8 +24,6 @@#include <net/ip.h> #include <net/ipv6.h> -#include "../core/sock_destructor.h" -/* Use skb->cb to track consecutive/adjacent fragments coming at * the end of the queue. Nodes in the rb-tree queue will * contain "runs" of one or more adjacent fragments.
net/ipv4/tcp_output.c +1 -0
@@ -1415,6 +1415,7 @@ void tcp_wfree(struct sk_buff *skb) out:sk_free (sk); } +EXPORT_SYMBOL_GPL (tcp_wfree);/* Note: Called under soft irq. * We can call TCP stack right away, unless socket is owned by user.
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
Re: [PATCH net-next 1/2] net: make is_skb_wmem() available to modules
Quoted 5 lines · Eric Dumazet
Following patch will use
is_skb_wmem()fromfq_codel.Provide
__sock_wfree()only ifCONFIG_INET=ySigned-off-by Eric Dumazet <[email protected]>
PATCH 2/2 net/sched: fq_codel: local packets no longer count against memory limit
In reply to Eric DumazetCommit 95b58430abe7 ("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."
In practice, this is not the case.
Packets that are associated with local sockets sk_wmem_alloc do not really need additional memory control.
--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_fq_codel.c +1 -1
@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
Re: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 4 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Well, the assumption lasted a decade, so that's pretty good? :)
Quoted 13 lines
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 216
Quoted 6 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage;
Only one concern here: q->memory_usage is exposed to userspace in the stats, so this will look like the packets queued are zero-length to anyone watching, which may end up confusing folks? Also, there will be no way to see how many bytes are actually in the qdisc.
Should we keep a separate counter so we can still accurately report the memory usage to userspace?
-Toke
Re: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 18 lines · Toke Høiland-Jørgensen
Quoted 4 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Well, the assumption lasted a decade, so that's pretty good? :)
Quoted 8 lines
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 216
Quoted 11 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage;Only one concern here:
q->memory_usageis exposed to userspace in the stats, so this will look like the packets queued are zero-length to anyone watching, which may end up confusing folks? Also, there will be no way to see how many bytes are actually in the qdisc.
Standard qdisc stats show the amount of bytes and packets.
None of the other qdiscs seem to care (except cake which copy/pasted fq_codel)
Quoted 3 lines
Should we keep a separate counter so we can still accurately report the memory usage to userspace?
Only purpose of mem usage counter was to have an idea of how close of the 32Mb limit we were,
this is still reported for forwarded packets (router workload)
All these counters take precious resources, I would rather not add another one.
Toke Høiland-Jørgensen
Reviewed-byRe: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 36 lines · Eric Dumazet
Quoted 18 lines · Toke Høiland-Jørgensen
Quoted 4 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Well, the assumption lasted a decade, so that's pretty good? :)
Quoted 8 lines
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 216
Quoted 11 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage;Only one concern here:
q->memory_usageis exposed to userspace in the stats, so this will look like the packets queued are zero-length to anyone watching, which may end up confusing folks? Also, there will be no way to see how many bytes are actually in the qdisc.
Quoted 3 lines
Standard qdisc stats show the amount of bytes and packets.
None of the other qdiscs seem to care (except cake which copy/pasted
fq_codel)
Right, the cake stats was why I asked. Pretty sure there are people who watch these; but now that you mention it, I may have confused the standard backlog_bytes stat field with this one...
Quoted 8 lines
Quoted 2 lines
Should we keep a separate counter so we can still accurately report the memory usage to userspace?
Only purpose of mem usage counter was to have an idea of how close of the 32Mb limit we were, this is still reported for forwarded packets (router workload)
All these counters take precious resources, I would rather not add another one.
Right, fair (and see above). In that case:
Paolo Abeni
maintainerRe: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
In reply to Eric DumazetQuoted 18 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0
net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 218
Quoted 8 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);
I *think* this patch is causing TDC self-tests failures:
# not ok 704 a4bb - Test FQ_CODEL with HTB parent - force packet drop with empty queue # Could not match regex pattern. Verify command output: # qdisc fq_codel 10: parent 1:10 limit 10240p flows 1 quantum 1514 target 99us interval 999us memory_limit 1b ecn drop_batch 64 # Sent 490 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) # backlog 0b 0p requeues 0 # maxpacket 98 drop_overlimit 0 new_flow_count 1 ecn_mark 0 # new_flows_len 1 old_flows_len 0
whole log at:
https://github.com/p4tc-dev/tc-executor/tree/storage/artifacts/645644/1-tdc-sh
Looking at the test code, I think the patch broke it, but the failures started a little afterward the patch merge, so I'm possibly misunderstanding something here.
Thanks,
Paolo
Re: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 43 lines · Paolo Abeni
Quoted 18 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 218
Quoted 8 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);I *think* this patch is causing TDC self-tests failures:
# not ok 704 a4bb - Test FQ_CODEL with HTB parent - force packet drop with empty queue # Could not match regex pattern. Verify command output: # qdisc fq_codel 10: parent 1:10 limit 10240p flows 1 quantum 1514 target 99us interval 999us memory_limit 1b ecn drop_batch 64 # Sent 490 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) # backlog 0b 0p requeues 0 # maxpacket 98 drop_overlimit 0 new_flow_count 1 ecn_mark 0 # new_flows_len 1 old_flows_len 0whole log at:
https://github.com/p4tc-dev/tc-executor/tree/storage/artifacts/645644/1-tdc-sh
Quoted 8 lines
Looking at the test code, I think the patch broke it, but the failures started a little afterward the patch merge, so I'm possibly misunderstanding something here.
Thanks,
Paolo
It seems this test uses a memory limit of 1 byte.
$TC qdisc add dev $DUMMY parent 1:10 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms
This might be a typo, I think they expected a limit of 0 packet.
commit cbe9588b12d058cbb16735fd468c82ec4b3d1256
Author: Cong Wang <[email protected]> Date: Thu Apr 3 14:16:32 2025 -0700
selftests/tc-testing: Add a test case for FQ_CODEL with HTB parent
Add a test case for FQ_CODEL with HTB parent to verify packet drop behavior when the queue becomes empty. This helps ensure proper notification mechanisms between qdiscs.
Note this is best-effort, it is hard to play with those parameters perfectly to always trigger ->qlen_notify().
Re: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 74 lines · Eric Dumazet
Quoted 43 lines · Paolo Abeni
Quoted 18 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 218
Quoted 8 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);I *think* this patch is causing TDC self-tests failures:
# not ok 704 a4bb - Test FQ_CODEL with HTB parent - force packet drop with empty queue # Could not match regex pattern. Verify command output: # qdisc fq_codel 10: parent 1:10 limit 10240p flows 1 quantum 1514 target 99us interval 999us memory_limit 1b ecn drop_batch 64 # Sent 490 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) # backlog 0b 0p requeues 0 # maxpacket 98 drop_overlimit 0 new_flow_count 1 ecn_mark 0 # new_flows_len 1 old_flows_len 0whole log at:
https://github.com/p4tc-dev/tc-executor/tree/storage/artifacts/645644/1-tdc-sh
Quoted 8 lines
Looking at the test code, I think the patch broke it, but the failures started a little afterward the patch merge, so I'm possibly misunderstanding something here.
Thanks,
Paolo
It seems this test uses a memory limit of 1 byte.
$TC qdisc add dev $DUMMY parent 1:10 handle 10:
fq_codelmemory_limit1 flows 1 target 0.1ms interval 1msThis might be a typo, I think they expected a limit of 0 packet.
commit
cbe9588b12d058cbb16735fd468c82ec4b3d1256Author: Cong Wang <[email protected]> Date: Thu Apr 3 14:16:32 2025 -0700selftests/tc-testing: Add a test case for
FQ_CODELwith HTB parentAdd a test case for
FQ_CODELwith HTB parent to verify packet drop behavior when the queue becomes empty. This helps ensure proper notification mechanisms between qdiscs.Note this is best-effort, it is hard to play with those parameters perfectly to always trigger ->qlen_notify().
Quoted 6 lines
Cc Pedro Tammela <[email protected]>Signed-off-by Cong Wang <[email protected]>Reviewed-by Victor Nogueira <[email protected]>Acked-by Jamal Hadi Salim <[email protected]>Signed-off-by Paolo Abeni <[email protected]>
I do not think we care much about the precise
get_codel_cb(skb)->mem_usage value.
A value of 2 bytes would let the test pass.
net/sched/sch_fq_codel.c +0 -0
100644
net/sched/sch_fq_codel.c +0 -0
@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb,
struct Qdisc *sch,
q->new_flow_count++;
WRITE_ONCE(flow->deficit, q->quantum);
}
- get_codel_cb(skb)->mem_usage = is_skb_wmem(skb) ? 0 : skb->truesize;
+ get_codel_cb(skb)->mem_usage = is_skb_wmem(skb) ? 2 : skb->truesize;
q->memory_usage += get_codel_cb(skb)->mem_usage;
memory_limited = q->memory_usage > q->memory_limit;
qdisc_qlen_inc(sch);Paolo Abeni
maintainerRe: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
In reply to Eric DumazetQuoted 52 lines · Eric Dumazet
Quoted 42 lines · Paolo Abeni
Quoted 18 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 218
Quoted 8 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);I *think* this patch is causing TDC self-tests failures:
# not ok 704 a4bb - Test FQ_CODEL with HTB parent - force packet drop with empty queue # Could not match regex pattern. Verify command output: # qdisc fq_codel 10: parent 1:10 limit 10240p flows 1 quantum 1514 target 99us interval 999us memory_limit 1b ecn drop_batch 64 # Sent 490 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) # backlog 0b 0p requeues 0 # maxpacket 98 drop_overlimit 0 new_flow_count 1 ecn_mark 0 # new_flows_len 1 old_flows_len 0whole log at:
https://github.com/p4tc-dev/tc-executor/tree/storage/artifacts/645644/1-tdc-sh
Quoted 8 lines
Looking at the test code, I think the patch broke it, but the failures started a little afterward the patch merge, so I'm possibly misunderstanding something here.
Thanks,
Paolo
Quoted 6 lines
It seems this test uses a memory limit of 1 byte.
$TC qdisc add dev $DUMMY parent 1:10 handle 10:
fq_codelmemory_limit1 flows 1 target 0.1ms interval 1msThis might be a typo, I think they expected a limit of 0 packet.
FTR, I think/agree a change to the self-tests would be preferable.
/P
Re: [PATCH net-next 2/2] net/sched: fq_codel: local packets no longer count against memory limit
Quoted 53 lines · Paolo Abeni
Quoted 52 lines · Eric Dumazet
Quoted 50 lines · Paolo Abeni
Quoted 18 lines · Eric Dumazet
Commit
95b58430abe7("fq_codel: add memory limitation per queue") claimed that the 32Mb default was "reasonable even for heavy duty usages."In practice, this is not the case.
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.Signed-off-by Eric Dumazet <[email protected]>--- net/sched/sch_fq_codel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sched/sch_fq_codel.c +0
-0net/sched/sch_fq_codel.c static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, · line 218
Quoted 8 lines
net/sched/sch_fq_codel.c +1
-1@@ -212,7 +212,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, q->new_flow_count++;WRITE_ONCE (flow->deficit, q->quantum); } -get_codel_cb (skb)->mem_usage = skb->truesize; +get_codel_cb (skb)->mem_usage =is_skb_wmem (skb) ?0 : skb->truesize; q->memory_usage +=get_codel_cb (skb)->mem_usage; memory_limited = q->memory_usage > q->memory_limit;qdisc_qlen_inc (sch);I *think* this patch is causing TDC self-tests failures:
# not ok 704 a4bb - Test FQ_CODEL with HTB parent - force packet drop with empty queue # Could not match regex pattern. Verify command output: # qdisc fq_codel 10: parent 1:10 limit 10240p flows 1 quantum 1514 target 99us interval 999us memory_limit 1b ecn drop_batch 64 # Sent 490 bytes 5 pkt (dropped 0, overlimits 0 requeues 0) # backlog 0b 0p requeues 0 # maxpacket 98 drop_overlimit 0 new_flow_count 1 ecn_mark 0 # new_flows_len 1 old_flows_len 0whole log at:
https://github.com/p4tc-dev/tc-executor/tree/storage/artifacts/645644/1-tdc-sh
Looking at the test code, I think the patch broke it, but the failures started a little afterward the patch merge, so I'm possibly misunderstanding something here.
Thanks,
Paolo
Quoted 8 lines
Quoted 6 lines
It seems this test uses a memory limit of 1 byte.
$TC qdisc add dev $DUMMY parent 1:10 handle 10:
fq_codelmemory_limit1 flows 1 target 0.1ms interval 1msThis might be a typo, I think they expected a limit of 0 packet.
FTR, I think/agree a change to the self-tests would be preferable.
Eric, do you have a tdc fix lined up for this one? If not, I can work something out here and send.
cheers,
Victor
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 12 May 2026 09:48:57 +0000 you wrote:
Packets that are associated with local sockets
sk_wmem_allocdo not really need additional memory control.First patch makes
is_skb_wmem()available to modules.Second patch uses
is_skb_wmem()infq_codel.[...]
Here is the summary with links:
- [net-next,1/2] net: make is_skb_wmem() available to modules
https://git.kernel.org/netdev/net-next/c/f0de88303d5e - [net-next,2/2] net/sched: fq_codel: local packets no longer count against memory limit https://git.kernel.org/netdev/net-next/c/150061a20651
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html