Thread (4 messages) flat view 4 messages, 3 authors, 11d ago

Re: [PATCH net-next v3] net: sched: act_gact: use acquire/release for tcfg_ptype

From: Jinjie Ruan <hidden>
Date: 2026-09-07 08:05:56
Also in: lkml


在 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);
+               }
        }


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help