Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary RCU grace period chaining #15

Open
wants to merge 5 commits into
base: rcu-dev
Choose a base branch
from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: Remove unnecessary RCU grace period chaining
version: 1
url: https://patchwork.kernel.org/project/rcu/list/?series=684412

@kernel-patches-bot
Copy link
Author

Master branch: 4b9dfbb
series: https://patchwork.kernel.org/project/rcu/list/?series=684412
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/rcu/list/?series=684412
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am -3
  stdout: 'Applying: bpf: Free elements after one RCU-tasks-trace grace period
Patch failed at 0001 bpf: Free elements after one RCU-tasks-trace grace period
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: sha1 information is lacking or useless (kernel/bpf/memalloc.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:


@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

paulmckrcu and others added 4 commits October 20, 2022 09:39
As an accident of implementation, an RCU Tasks Trace grace period also
acts as an RCU grace period.  However, this could change at any time.
This commit therefore creates an rcu_trace_implies_rcu_gp() that currently
returns true to codify this accident.  Code relying on this accident
must call this function to verify that this accident is still happening.

Reported-by: Hou Tao <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
The memory free logic in bpf memory allocator chains a RCU Tasks Trace
grace period and a normal RCU grace period one after the other, so it
can ensure that both sleepable and non-sleepable programs have finished.

With the introduction of rcu_trace_implies_rcu_gp(),
__free_rcu_tasks_trace() can check whether or not a normal RCU grace
period has also passed after a RCU Tasks Trace grace period has passed.
If it is true, freeing these elements directly, else freeing through
call_rcu().

Signed-off-by: Hou Tao <[email protected]>
Local storage map is accessible for both sleepable and non-sleepable bpf
program, and its memory is freed by using both call_rcu_tasks_trace() and
kfree_rcu() to wait for both RCU-tasks-trace grace period and RCU grace
period to pass.

With the introduction of rcu_trace_implies_rcu_gp(), both
bpf_selem_free_rcu() and bpf_local_storage_free_rcu() can check whether
or not a normal RCU grace period has also passed after a RCU-tasks-trace
grace period has passed. If it is true, it is safe to call kfree()
directly.

Signed-off-by: Hou Tao <[email protected]>
To support both sleepable and normal uprobe bpf program, the freeing of
trace program array chains a RCU-tasks-trace grace period and a normal
RCU grace period one after the other.

With the introduction of rcu_trace_implies_rcu_gp(),
__bpf_prog_array_free_sleepable_cb() can check whether or not a normal
RCU grace period has also passed after a RCU-tasks-trace grace period
has passed. If it is true, it is safe to invoke kfree() directly.

Signed-off-by: Hou Tao <[email protected]>
@kernel-patches-bot
Copy link
Author

Master branch: fa70e60
series: https://patchwork.kernel.org/project/rcu/list/?series=685353
version: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants