Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164339
b: refs/heads/master
c: 16e3081
h: refs/heads/master
i:
  164337: 0cac7a6
  164335: fc4e6c9
v: v3
  • Loading branch information
Paul E. McKenney authored and Ingo Molnar committed Sep 17, 2009
1 parent 599a1b1 commit 2f7878d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3422bea5f09b0e85704f51f2b01271630b8940b
refs/heads/master: 16e3081191837a6a04733de5cd5d1d1b303140d4
23 changes: 5 additions & 18 deletions trunk/include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ struct rcu_head {
};

/* Exported common interfaces */
#ifdef CONFIG_TREE_PREEMPT_RCU
extern void synchronize_rcu(void);
#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
#define synchronize_rcu synchronize_sched
#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
extern void synchronize_rcu_bh(void);
extern void synchronize_sched(void);
extern void rcu_barrier(void);
extern void rcu_barrier_bh(void);
extern void rcu_barrier_sched(void);
Expand Down Expand Up @@ -261,24 +266,6 @@ struct rcu_synchronize {

extern void wakeme_after_rcu(struct rcu_head *head);

/**
* synchronize_sched - block until all CPUs have exited any non-preemptive
* kernel code sequences.
*
* This means that all preempt_disable code sequences, including NMI and
* hardware-interrupt handlers, in progress on entry will have completed
* before this primitive returns. However, this does not guarantee that
* softirq handlers will have completed, since in some kernels, these
* handlers can run in process context, and can block.
*
* This primitive provides the guarantees made by the (now removed)
* synchronize_kernel() API. In contrast, synchronize_rcu() only
* guarantees that rcu_read_lock() sections will have completed.
* In "classic RCU", these two guarantees happen to be one and
* the same, but can differ in realtime RCU implementations.
*/
#define synchronize_sched() __synchronize_sched()

/**
* call_rcu - Queue an RCU callback for invocation after a grace period.
* @head: structure to be used for queueing the RCU updates.
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/rcutree.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static inline void __rcu_read_unlock(void)
preempt_enable();
}

#define __synchronize_sched() synchronize_rcu()

static inline void exit_rcu(void)
{
}
Expand All @@ -68,8 +70,6 @@ static inline void __rcu_read_unlock_bh(void)
local_bh_enable();
}

#define __synchronize_sched() synchronize_rcu()

extern void call_rcu_sched(struct rcu_head *head,
void (*func)(struct rcu_head *rcu));

Expand Down
44 changes: 43 additions & 1 deletion trunk/kernel/rcupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ void wakeme_after_rcu(struct rcu_head *head)
complete(&rcu->completion);
}

#ifdef CONFIG_TREE_PREEMPT_RCU

/**
* synchronize_rcu - wait until a grace period has elapsed.
*
Expand All @@ -87,7 +89,7 @@ void synchronize_rcu(void)
{
struct rcu_synchronize rcu;

if (rcu_blocking_is_gp())
if (!rcu_scheduler_active)
return;

init_completion(&rcu.completion);
Expand All @@ -98,6 +100,46 @@ void synchronize_rcu(void)
}
EXPORT_SYMBOL_GPL(synchronize_rcu);

#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */

/**
* synchronize_sched - wait until an rcu-sched grace period has elapsed.
*
* Control will return to the caller some time after a full rcu-sched
* grace period has elapsed, in other words after all currently executing
* rcu-sched read-side critical sections have completed. These read-side
* critical sections are delimited by rcu_read_lock_sched() and
* rcu_read_unlock_sched(), and may be nested. Note that preempt_disable(),
* local_irq_disable(), and so on may be used in place of
* rcu_read_lock_sched().
*
* This means that all preempt_disable code sequences, including NMI and
* hardware-interrupt handlers, in progress on entry will have completed
* before this primitive returns. However, this does not guarantee that
* softirq handlers will have completed, since in some kernels, these
* handlers can run in process context, and can block.
*
* This primitive provides the guarantees made by the (now removed)
* synchronize_kernel() API. In contrast, synchronize_rcu() only
* guarantees that rcu_read_lock() sections will have completed.
* In "classic RCU", these two guarantees happen to be one and
* the same, but can differ in realtime RCU implementations.
*/
void synchronize_sched(void)
{
struct rcu_synchronize rcu;

if (rcu_blocking_is_gp())
return;

init_completion(&rcu.completion);
/* Will wake me after RCU finished. */
call_rcu_sched(&rcu.head, wakeme_after_rcu);
/* Wait for it. */
wait_for_completion(&rcu.completion);
}
EXPORT_SYMBOL_GPL(synchronize_sched);

/**
* synchronize_rcu_bh - wait until an rcu_bh grace period has elapsed.
*
Expand Down

0 comments on commit 2f7878d

Please sign in to comment.