mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
bpf: Use __llist_del_all() whenever possbile during memory draining
Except for waiting_for_gp list, there are no concurrent operations on free_by_rcu, free_llist and free_llist_extra lists, so use __llist_del_all() instead of llist_del_all(). waiting_for_gp list can be deleted by RCU callback concurrently, so still use llist_del_all(). Acked-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/r/20221021114913.60508-3-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
3d05818707
commit
fa4447cb73
1 changed files with 5 additions and 2 deletions
|
@ -418,14 +418,17 @@ static void drain_mem_cache(struct bpf_mem_cache *c)
|
||||||
/* No progs are using this bpf_mem_cache, but htab_map_free() called
|
/* No progs are using this bpf_mem_cache, but htab_map_free() called
|
||||||
* bpf_mem_cache_free() for all remaining elements and they can be in
|
* bpf_mem_cache_free() for all remaining elements and they can be in
|
||||||
* free_by_rcu or in waiting_for_gp lists, so drain those lists now.
|
* free_by_rcu or in waiting_for_gp lists, so drain those lists now.
|
||||||
|
*
|
||||||
|
* Except for waiting_for_gp list, there are no concurrent operations
|
||||||
|
* on these lists, so it is safe to use __llist_del_all().
|
||||||
*/
|
*/
|
||||||
llist_for_each_safe(llnode, t, __llist_del_all(&c->free_by_rcu))
|
llist_for_each_safe(llnode, t, __llist_del_all(&c->free_by_rcu))
|
||||||
free_one(c, llnode);
|
free_one(c, llnode);
|
||||||
llist_for_each_safe(llnode, t, llist_del_all(&c->waiting_for_gp))
|
llist_for_each_safe(llnode, t, llist_del_all(&c->waiting_for_gp))
|
||||||
free_one(c, llnode);
|
free_one(c, llnode);
|
||||||
llist_for_each_safe(llnode, t, llist_del_all(&c->free_llist))
|
llist_for_each_safe(llnode, t, __llist_del_all(&c->free_llist))
|
||||||
free_one(c, llnode);
|
free_one(c, llnode);
|
||||||
llist_for_each_safe(llnode, t, llist_del_all(&c->free_llist_extra))
|
llist_for_each_safe(llnode, t, __llist_del_all(&c->free_llist_extra))
|
||||||
free_one(c, llnode);
|
free_one(c, llnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue