在 2026/9/6 4:42, Jakub Kicinski 写道:
On Wed, 2 Sep 2026 15:16:59 +0800 Jinjie Ruan wrote:
quoted
@@ -160,7 +155,8 @@ TC_INDIRECT_SCOPE int tcf_gact_act(struct sk_buff *skb,
#ifdef CONFIG_GACT_PROB
{
- u32 ptype = READ_ONCE(gact->tcfg_ptype);
+ /* Pairs with smp_store_release() in tcf_gact_init() */
+ u32 ptype = smp_load_acquire(&gact->tcfg_ptype);
if (ptype)
action = gact_rand[ptype](gact);
Clashiko points out that you are turning what used to be a conditional
barrier into one that's always obeyed, even if ptype is 0.
What do you think of the following fix?
#ifdef CONFIG_GACT_PROB
{
- u32 ptype = READ_ONCE(gact->tcfg_ptype);
+ u32 ptype = READ_ONCE(gact->tcfg_ptype);
- if (ptype)
- action = gact_rand[ptype](gact);
+ if (ptype) {
+ /* Pairs with smp_store_release() in
tcf_gact_init() */
+ ptype = smp_load_acquire(&gact->tcfg_ptype);
+ if (ptype)
+ action = gact_rand[ptype](gact);
+ }
}