Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
srcu.c File Reference
#include <linux/export.h>
#include <linux/mutex.h>
#include <linux/percpu.h>
#include <linux/preempt.h>
#include <linux/rcupdate.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/delay.h>
#include <linux/srcu.h>

Go to the source code of this file.

Data Structures

struct  rcu_synchronize
 

Macros

#define SRCU_RETRY_CHECK_DELAY   5
 
#define SYNCHRONIZE_SRCU_TRYCOUNT   2
 
#define SYNCHRONIZE_SRCU_EXP_TRYCOUNT   12
 
#define SRCU_CALLBACK_BATCH   10
 
#define SRCU_INTERVAL   1
 

Functions

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

Macro Definition Documentation

#define SRCU_CALLBACK_BATCH   10

Definition at line 514 of file srcu.c.

#define SRCU_INTERVAL   1

Definition at line 515 of file srcu.c.

#define SRCU_RETRY_CHECK_DELAY   5

Definition at line 336 of file srcu.c.

#define SYNCHRONIZE_SRCU_EXP_TRYCOUNT   12

Definition at line 338 of file srcu.c.

#define SYNCHRONIZE_SRCU_TRYCOUNT   2

Definition at line 337 of file srcu.c.

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.

EXPORT_SYMBOL_GPL ( init_srcu_struct  )
EXPORT_SYMBOL_GPL ( cleanup_srcu_struct  )
EXPORT_SYMBOL_GPL ( __srcu_read_lock  )
EXPORT_SYMBOL_GPL ( __srcu_read_unlock  )
EXPORT_SYMBOL_GPL ( call_srcu  )
EXPORT_SYMBOL_GPL ( synchronize_srcu  )
EXPORT_SYMBOL_GPL ( synchronize_srcu_expedited  )
EXPORT_SYMBOL_GPL ( srcu_barrier  )
EXPORT_SYMBOL_GPL ( srcu_batches_completed  )
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.