mbox series

[bpf-next,0/3] Remove unnecessary RCU grace period chaining

Message ID 20221011071128.3470622-1-houtao@huaweicloud.com (mailing list archive)
Headers show
Series Remove unnecessary RCU grace period chaining | expand

Message

Hou Tao Oct. 11, 2022, 7:11 a.m. UTC
From: Hou Tao <houtao1@huawei.com>

Hi,

Now bpf uses RCU grace period chaining to wait for the completion of
access from both sleepable and non-sleepable bpf program: calling
call_rcu_tasks_trace() firstly to wait for a RCU-tasks-trace grace
period, then in its callback calls call_rcu() or kfree_rcu() to wait for
a normal RCU grace period.

According to the implementation of RCU Tasks Trace, it inovkes
->postscan_func() to wait for one RCU-tasks-trace grace period and
rcu_tasks_trace_postscan() inovkes synchronize_rcu() to wait for one
normal RCU grace period in turn, so one RCU-tasks-trace grace period
will imply one normal RCU grace period. And it also means there is no
need to do call_rcu() or kfree_rcu() again in the callback of
call_rcu_tasks_trace() in these grace period chains, so just remove the
unnecessary call_rcu() or kfree_rcu() calls.

Comments are always welcome.

Hou Tao (3):
  bpf: Free elements after one RCU-tasks-trace grace period
  bpf: Free local storage memory after one RCU-tasks-trace grace period
  bpf: Free trace program array after one RCU-tasks-trace grace period

 kernel/bpf/bpf_local_storage.c | 10 ++++++++--
 kernel/bpf/core.c              |  5 ++++-
 kernel/bpf/memalloc.c          | 17 ++++++-----------
 3 files changed, 18 insertions(+), 14 deletions(-)