Re: [PATCH net v7 1/1] net/sched: act_gate: snapshot parameters with RCU on replace

From: Paul Moses

Date: Sun Feb 22 2026 - 09:14:19 EST


Yes, I only see it as unreachable code cleanup.

While looking at cycletime, should I move that block before
spin_lock_bh()? It only touches the private p snapshot before it
is published, so it looks safe to run outside the lock. I am not sure
where the line is before this turns into a refactor.



diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
index d09013ae1892a..660d833dce557 100644
--- a/net/sched/act_gate.c
+++ b/net/sched/act_gate.c
@@ -483,6 +483,15 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
goto err_free;
timer_clockid = clockid;

+ if (!cycletime) {
+ struct tcfg_gate_entry *entry;
+ ktime_t cycle = 0;
+
+ list_for_each_entry(entry, &p->entries, list)
+ cycle = ktime_add_ns(cycle, entry->interval);
+ cycletime = cycle;
+ }
+
need_cancel = ret != ACT_P_CREATED &&
gate_timer_needs_cancel(basetime, old_basetime,
tko, old_tk_offset,
@@ -493,14 +502,6 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,

spin_lock_bh(&gact->tcf_lock);

- if (!cycletime) {
- struct tcfg_gate_entry *entry;
- ktime_t cycle = 0;
-
- list_for_each_entry(entry, &p->entries, list)
- cycle = ktime_add_ns(cycle, entry->interval);
- cycletime = cycle;
- }
p->tcfg_cycletime = cycletime;
p->tcfg_cycletime_ext = cycletime_ext;