Skip to content

Commit 445d374

Browse files
committed
net/sched: Replace rcu_swap_protected() with rcu_replace_pointer()
This commit replaces the use of rcu_swap_protected() with the more intuitively appealing rcu_replace_pointer() as a step towards removing rcu_swap_protected(). Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds <[email protected]> [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney <[email protected]> Cc: Jamal Hadi Salim <[email protected]> Cc: Cong Wang <[email protected]> Cc: Jiri Pirko <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: <[email protected]> Cc: <[email protected]>
1 parent b685b53 commit 445d374

File tree

12 files changed

+21
-20
lines changed

12 files changed

+21
-20
lines changed

net/sched/act_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct tcf_chain *tcf_action_set_ctrlact(struct tc_action *a, int action,
8888
struct tcf_chain *goto_chain)
8989
{
9090
a->tcfa_action = action;
91-
rcu_swap_protected(a->goto_chain, goto_chain, 1);
91+
goto_chain = rcu_replace_pointer(a->goto_chain, goto_chain, 1);
9292
return goto_chain;
9393
}
9494
EXPORT_SYMBOL(tcf_action_set_ctrlact);

net/sched/act_csum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
101101

102102
spin_lock_bh(&p->tcf_lock);
103103
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
104-
rcu_swap_protected(p->params, params_new,
105-
lockdep_is_held(&p->tcf_lock));
104+
params_new = rcu_replace_pointer(p->params, params_new,
105+
lockdep_is_held(&p->tcf_lock));
106106
spin_unlock_bh(&p->tcf_lock);
107107

108108
if (goto_ch)

net/sched/act_ct.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,8 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
722722

723723
spin_lock_bh(&c->tcf_lock);
724724
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
725-
rcu_swap_protected(c->params, params, lockdep_is_held(&c->tcf_lock));
725+
params = rcu_replace_pointer(c->params, params,
726+
lockdep_is_held(&c->tcf_lock));
726727
spin_unlock_bh(&c->tcf_lock);
727728

728729
if (goto_ch)

net/sched/act_ctinfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
257257

258258
spin_lock_bh(&ci->tcf_lock);
259259
goto_ch = tcf_action_set_ctrlact(*a, actparm->action, goto_ch);
260-
rcu_swap_protected(ci->params, cp_new,
261-
lockdep_is_held(&ci->tcf_lock));
260+
cp_new = rcu_replace_pointer(ci->params, cp_new,
261+
lockdep_is_held(&ci->tcf_lock));
262262
spin_unlock_bh(&ci->tcf_lock);
263263

264264
if (goto_ch)

net/sched/act_ife.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
594594
spin_lock_bh(&ife->tcf_lock);
595595
/* protected by tcf_lock when modifying existing action */
596596
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
597-
rcu_swap_protected(ife->params, p, 1);
597+
p = rcu_replace_pointer(ife->params, p, 1);
598598

599599
if (exists)
600600
spin_unlock_bh(&ife->tcf_lock);

net/sched/act_mirred.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
178178
goto put_chain;
179179
}
180180
mac_header_xmit = dev_is_mac_header_xmit(dev);
181-
rcu_swap_protected(m->tcfm_dev, dev,
182-
lockdep_is_held(&m->tcf_lock));
181+
dev = rcu_replace_pointer(m->tcfm_dev, dev,
182+
lockdep_is_held(&m->tcf_lock));
183183
if (dev)
184184
dev_put(dev);
185185
m->tcfm_mac_header_xmit = mac_header_xmit;

net/sched/act_mpls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static int tcf_mpls_init(struct net *net, struct nlattr *nla,
258258

259259
spin_lock_bh(&m->tcf_lock);
260260
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
261-
rcu_swap_protected(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
261+
p = rcu_replace_pointer(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
262262
spin_unlock_bh(&m->tcf_lock);
263263

264264
if (goto_ch)

net/sched/act_police.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
191191
police->tcfp_ptoks = new->tcfp_mtu_ptoks;
192192
spin_unlock_bh(&police->tcfp_lock);
193193
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
194-
rcu_swap_protected(police->params,
195-
new,
196-
lockdep_is_held(&police->tcf_lock));
194+
new = rcu_replace_pointer(police->params,
195+
new,
196+
lockdep_is_held(&police->tcf_lock));
197197
spin_unlock_bh(&police->tcf_lock);
198198

199199
if (goto_ch)

net/sched/act_sample.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
102102
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
103103
s->rate = rate;
104104
s->psample_group_num = psample_group_num;
105-
rcu_swap_protected(s->psample_group, psample_group,
106-
lockdep_is_held(&s->tcf_lock));
105+
psample_group = rcu_replace_pointer(s->psample_group, psample_group,
106+
lockdep_is_held(&s->tcf_lock));
107107

108108
if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
109109
s->truncate = true;

net/sched/act_skbedit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
206206

207207
spin_lock_bh(&d->tcf_lock);
208208
goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
209-
rcu_swap_protected(d->params, params_new,
210-
lockdep_is_held(&d->tcf_lock));
209+
params_new = rcu_replace_pointer(d->params, params_new,
210+
lockdep_is_held(&d->tcf_lock));
211211
spin_unlock_bh(&d->tcf_lock);
212212
if (params_new)
213213
kfree_rcu(params_new, rcu);

0 commit comments

Comments
 (0)