Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
srcu.h File Reference
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  srcu_struct_array
 
struct  rcu_batch
 
struct  srcu_struct
 

Macros

#define srcu_dereference_check(p, sp, c)   __rcu_dereference_check((p), srcu_read_lock_held(sp) || (c), __rcu)
 
#define srcu_dereference(p, sp)   srcu_dereference_check((p), (sp), 0)
 

Functions

int init_srcu_struct (struct srcu_struct *sp)
 
void call_srcu (struct srcu_struct *sp, struct rcu_head *head, void(*func)(struct rcu_head *head))
 
void cleanup_srcu_struct (struct srcu_struct *sp)
 
int __srcu_read_lock (struct srcu_struct *sp) __acquires(sp)
 
void __srcu_read_unlock (struct srcu_struct *sp, int idx) __releases(sp)
 
void synchronize_srcu (struct srcu_struct *sp)
 
void synchronize_srcu_expedited (struct srcu_struct *sp)
 
long srcu_batches_completed (struct srcu_struct *sp)
 
void srcu_barrier (struct srcu_struct *sp)
 

Macro Definition Documentation

#define srcu_dereference (   p,
  sp 
)    srcu_dereference_check((p), (sp), 0)

srcu_dereference - fetch SRCU-protected pointer for later dereferencing : the pointer to fetch and protect for later dereferencing : pointer to the srcu_struct, which is used to check that we really are in an SRCU read-side critical section.

Makes rcu_dereference_check() do the dirty work. If PROVE_RCU is enabled, invoking this outside of an RCU read-side critical section will result in an RCU-lockdep splat.

Definition at line 181 of file srcu.h.

#define srcu_dereference_check (   p,
  sp,
  c 
)    __rcu_dereference_check((p), srcu_read_lock_held(sp) || (c), __rcu)

srcu_dereference_check - fetch SRCU-protected pointer for later dereferencing : the pointer to fetch and protect for later dereferencing : pointer to the srcu_struct, which is used to check that we really are in an SRCU read-side critical section. : condition to check for update-side use

If PROVE_RCU is enabled, invoking this outside of an RCU read-side critical section will result in an RCU-lockdep splat, unless evaluates to 1. The argument will normally be a logical expression containing lockdep_is_held() calls.

Definition at line 168 of file srcu.h.

Function Documentation

int __srcu_read_lock ( struct srcu_struct sp)

Definition at line 298 of file srcu.c.

void __srcu_read_unlock ( struct srcu_struct sp,
int  idx 
)

Definition at line 319 of file srcu.c.

void call_srcu ( struct srcu_struct sp,
struct rcu_head head,
void(*)(struct rcu_head *head func 
)

call_srcu() - Queue a callback for invocation after an SRCU grace period : srcu_struct in queue the callback : structure to be used for queueing the SRCU callback. : function to be invoked after the SRCU grace period

The callback function will be invoked some time after a full SRCU grace period elapses, in other words after all pre-existing SRCU read-side critical sections have completed. However, the callback function might well execute concurrently with other SRCU read-side critical sections that started after call_srcu() was invoked. SRCU read-side critical sections are delimited by srcu_read_lock() and srcu_read_unlock(), and may be nested.

The callback will be invoked from process context, but must nevertheless be fast and must not block.

Definition at line 371 of file srcu.c.

void cleanup_srcu_struct ( struct srcu_struct sp)

cleanup_srcu_struct - deconstruct a sleep-RCU structure : structure to clean up.

Must invoke this after you are finished using a given srcu_struct that was initialized via init_srcu_struct(), else you leak memory.

Definition at line 280 of file srcu.c.

int init_srcu_struct ( struct srcu_struct sp)

init_srcu_struct - initialize a sleep-RCU structure : structure to initialize.

Must invoke this on a given srcu_struct before passing that srcu_struct to any other function. Each srcu_struct represents a separate domain of SRCU protection.

Definition at line 134 of file srcu.c.

void srcu_barrier ( struct srcu_struct sp)

srcu_barrier - Wait until all in-flight call_srcu() callbacks complete.

Definition at line 495 of file srcu.c.

long srcu_batches_completed ( struct srcu_struct sp)

srcu_batches_completed - return batches completed. : srcu_struct on which to report batch completion.

Report the number of batches, correlated with, but not necessarily precisely the same as, the number of grace periods that have elapsed.

Definition at line 508 of file srcu.c.

void synchronize_srcu ( struct srcu_struct sp)

synchronize_srcu - wait for prior SRCU read-side critical-section completion : srcu_struct with which to synchronize.

Flip the completed counter, and wait for the old count to drain to zero. As with classic RCU, the updater must use some separate means of synchronizing concurrent updates. Can block; must be called from process context.

Note that it is illegal to call synchronize_srcu() from the corresponding SRCU read-side critical section; doing so will result in deadlock. However, it is perfectly legal to call synchronize_srcu() on one srcu_struct from some other srcu_struct's read-side critical section.

Definition at line 465 of file srcu.c.

void synchronize_srcu_expedited ( struct srcu_struct sp)

synchronize_srcu_expedited - Brute-force SRCU grace period : srcu_struct with which to synchronize.

Wait for an SRCU grace period to elapse, but be more aggressive about spinning rather than blocking when waiting.

Note that it is illegal to call this function while holding any lock that is acquired by a CPU-hotplug notifier. It is also illegal to call synchronize_srcu_expedited() from the corresponding SRCU read-side critical section; doing so will result in deadlock. However, it is perfectly legal to call synchronize_srcu_expedited() on one srcu_struct from some other srcu_struct's read-side critical section, as long as the resulting graph of srcu_structs is acyclic.

Definition at line 486 of file srcu.c.