mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 10:02:02 +02:00
net: shaper: drop redundant xa_lock() bracketing
The shaper insertion and update code takes xa_lock() explicitly. Paolo explained that the locking was purely to avoid re-taking the lock in loops. But it may be mis-read as if it was expecting readers to be fenced off by xa_lock. Readers of XArray are purely under RCU. Remove explicit taking of xa_lock(). All writers to hierarchy->shapers are serialized by the netdev instance lock (or run after netdev is made inaccessible to readers). Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260609183224.1108521-2-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
e6d6a68f1d
commit
f26cddcf2a
|
|
@ -429,7 +429,6 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
|
|||
int index;
|
||||
int i;
|
||||
|
||||
xa_lock(&hierarchy->shapers);
|
||||
for (i = 0; i < nr_shapers; ++i) {
|
||||
index = net_shaper_handle_to_index(&shapers[i].handle);
|
||||
|
||||
|
|
@ -442,7 +441,6 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
|
|||
/* ... publish to lockless readers. */
|
||||
smp_store_release(&cur->valid, true);
|
||||
}
|
||||
xa_unlock(&hierarchy->shapers);
|
||||
}
|
||||
|
||||
/* Rollback all the tentative inserts from the hierarchy. */
|
||||
|
|
@ -455,14 +453,12 @@ static void net_shaper_rollback(struct net_shaper_binding *binding)
|
|||
if (!hierarchy)
|
||||
return;
|
||||
|
||||
xa_lock(&hierarchy->shapers);
|
||||
xa_for_each(&hierarchy->shapers, index, cur) {
|
||||
if (cur->valid)
|
||||
continue;
|
||||
__xa_erase(&hierarchy->shapers, index);
|
||||
xa_erase(&hierarchy->shapers, index);
|
||||
kfree_rcu(cur, rcu);
|
||||
}
|
||||
xa_unlock(&hierarchy->shapers);
|
||||
}
|
||||
|
||||
static int net_shaper_parse_handle(const struct nlattr *attr,
|
||||
|
|
@ -1472,12 +1468,10 @@ static void net_shaper_flush(struct net_shaper_binding *binding)
|
|||
if (!hierarchy)
|
||||
return;
|
||||
|
||||
xa_lock(&hierarchy->shapers);
|
||||
xa_for_each(&hierarchy->shapers, index, cur) {
|
||||
__xa_erase(&hierarchy->shapers, index);
|
||||
xa_erase(&hierarchy->shapers, index);
|
||||
kfree(cur);
|
||||
}
|
||||
xa_unlock(&hierarchy->shapers);
|
||||
|
||||
kfree(hierarchy);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user