diff options
| author | Simon Horman <[email protected]> | 2013-05-22 14:50:31 +0900 |
|---|---|---|
| committer | Pablo Neira Ayuso <[email protected]> | 2013-05-23 14:23:17 +0200 |
| commit | f6f3c437d09e2f62533034e67bfb4385191e992c (patch) | |
| tree | d7e08f57a89aa0d39405cb7bf609995e215dfb9a /tools/perf/scripts/python/netdev-times.py | |
| parent | de94c4591bd606729af1b913d6e98c6c449e42df (diff) | |
sched: add cond_resched_rcu() helper
This is intended for use in loops which read data protected by RCU and may
have a large number of iterations. Such an example is dumping the list of
connections known to IPVS: ip_vs_conn_array() and ip_vs_conn_seq_next().
The benefits are for CONFIG_PREEMPT_RCU=y where we save CPU cycles
by moving rcu_read_lock and rcu_read_unlock out of large loops
but still allowing the current task to be preempted after every
loop iteration for the CONFIG_PREEMPT_RCU=n case.
The call to cond_resched() is not needed when CONFIG_PREEMPT_RCU=y.
Thanks to Paul E. McKenney for explaining this and for the
final version that checks the context with CONFIG_DEBUG_ATOMIC_SLEEP=y
for all possible configurations.
The function can be empty in the CONFIG_PREEMPT_RCU case,
rcu_read_lock and rcu_read_unlock are not needed in this case
because the task can be preempted on indication from scheduler.
Thanks to Peter Zijlstra for catching this and for his help
in trying a solution that changes __might_sleep.
Initial cond_resched_rcu_lock() function suggested by Eric Dumazet.
Tested-by: Julian Anastasov <[email protected]>
Signed-off-by: Julian Anastasov <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/netdev-times.py')
0 files changed, 0 insertions, 0 deletions