Rev 6588 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6588 | Rev 6936 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include |
46 | #include |
47 | #include |
47 | #include |
Line 48... | Line 48... | ||
48 | 48 | ||
Line -... | Line 49... | ||
- | 49 | #include |
|
49 | #include |
50 | |
- | 51 | #ifndef CONFIG_TINY_RCU |
|
- | 52 | extern int rcu_expedited; /* for sysctl */ |
|
Line 50... | Line 53... | ||
50 | 53 | extern int rcu_normal; /* also for sysctl */ |
|
51 | extern int rcu_expedited; /* for sysctl */ |
54 | #endif /* #ifndef CONFIG_TINY_RCU */ |
- | 55 | ||
- | 56 | #ifdef CONFIG_TINY_RCU |
|
- | 57 | /* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */ |
|
- | 58 | static inline bool rcu_gp_is_normal(void) /* Internal RCU use. */ |
|
52 | 59 | { |
|
53 | #ifdef CONFIG_TINY_RCU |
60 | return true; |
54 | /* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */ |
61 | } |
55 | static inline bool rcu_gp_is_expedited(void) /* Internal RCU use. */ |
62 | static inline bool rcu_gp_is_expedited(void) /* Internal RCU use. */ |
Line 63... | Line 70... | ||
63 | 70 | ||
64 | static inline void rcu_unexpedite_gp(void) |
71 | static inline void rcu_unexpedite_gp(void) |
65 | { |
72 | { |
66 | } |
73 | } |
- | 74 | #else /* #ifdef CONFIG_TINY_RCU */ |
|
67 | #else /* #ifdef CONFIG_TINY_RCU */ |
75 | bool rcu_gp_is_normal(void); /* Internal RCU use. */ |
68 | bool rcu_gp_is_expedited(void); /* Internal RCU use. */ |
76 | bool rcu_gp_is_expedited(void); /* Internal RCU use. */ |
69 | void rcu_expedite_gp(void); |
77 | void rcu_expedite_gp(void); |
70 | void rcu_unexpedite_gp(void); |
78 | void rcu_unexpedite_gp(void); |
Line 281... | Line 289... | ||
281 | 289 | ||
Line 282... | Line 290... | ||
282 | #endif /* #else #ifdef CONFIG_PREEMPT_RCU */ |
290 | #endif /* #else #ifdef CONFIG_PREEMPT_RCU */ |
283 | 291 | ||
284 | /* Internal to kernel */ |
- | |
285 | void rcu_init(void); |
292 | /* Internal to kernel */ |
286 | void rcu_end_inkernel_boot(void); |
293 | void rcu_init(void); |
287 | void rcu_sched_qs(void); |
294 | void rcu_sched_qs(void); |
288 | void rcu_bh_qs(void); |
295 | void rcu_bh_qs(void); |
289 | void rcu_check_callbacks(int user); |
296 | void rcu_check_callbacks(int user); |
290 | struct notifier_block; |
297 | struct notifier_block; |
Line -... | Line 298... | ||
- | 298 | int rcu_cpu_notify(struct notifier_block *self, |
|
- | 299 | unsigned long action, void *hcpu); |
|
- | 300 | ||
- | 301 | #ifndef CONFIG_TINY_RCU |
|
- | 302 | void rcu_end_inkernel_boot(void); |
|
- | 303 | #else /* #ifndef CONFIG_TINY_RCU */ |
|
291 | int rcu_cpu_notify(struct notifier_block *self, |
304 | static inline void rcu_end_inkernel_boot(void) { } |
292 | unsigned long action, void *hcpu); |
305 | #endif /* #ifndef CONFIG_TINY_RCU */ |
293 | 306 | ||
294 | #ifdef CONFIG_RCU_STALL_COMMON |
307 | #ifdef CONFIG_RCU_STALL_COMMON |
295 | void rcu_sysrq_start(void); |
308 | void rcu_sysrq_start(void); |
Line 339... | Line 352... | ||
339 | * quite limited. If deeper nesting is required, it will be necessary |
352 | * quite limited. If deeper nesting is required, it will be necessary |
340 | * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. |
353 | * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. |
341 | */ |
354 | */ |
342 | #define RCU_NONIDLE(a) \ |
355 | #define RCU_NONIDLE(a) \ |
343 | do { \ |
356 | do { \ |
344 | rcu_irq_enter(); \ |
357 | rcu_irq_enter_irqson(); \ |
345 | do { a; } while (0); \ |
358 | do { a; } while (0); \ |
346 | rcu_irq_exit(); \ |
359 | rcu_irq_exit_irqson(); \ |
347 | } while (0) |
360 | } while (0) |
Line 348... | Line 361... | ||
348 | 361 | ||
349 | /* |
362 | /* |
350 | * Note a voluntary context switch for RCU-tasks benefit. This is a |
363 | * Note a voluntary context switch for RCU-tasks benefit. This is a |
Line 701... | Line 714... | ||
701 | 714 | ||
702 | /* |
715 | /* |
703 | * The tracing infrastructure traces RCU (we want that), but unfortunately |
716 | * The tracing infrastructure traces RCU (we want that), but unfortunately |
704 | * some of the RCU checks causes tracing to lock up the system. |
717 | * some of the RCU checks causes tracing to lock up the system. |
705 | * |
718 | * |
706 | * The tracing version of rcu_dereference_raw() must not call |
719 | * The no-tracing version of rcu_dereference_raw() must not call |
707 | * rcu_read_lock_held(). |
720 | * rcu_read_lock_held(). |
708 | */ |
721 | */ |
Line 709... | Line 722... | ||
709 | #define rcu_dereference_raw_notrace(p) __rcu_dereference_check((p), 1, __rcu) |
722 | #define rcu_dereference_raw_notrace(p) __rcu_dereference_check((p), 1, __rcu) |
Line 752... | Line 765... | ||
752 | * Makes rcu_dereference_check() do the dirty work. |
765 | * Makes rcu_dereference_check() do the dirty work. |
753 | */ |
766 | */ |
754 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0) |
767 | #define rcu_dereference_sched(p) rcu_dereference_sched_check(p, 0) |
Line 755... | Line 768... | ||
755 | 768 | ||
- | 769 | /** |
|
- | 770 | * rcu_pointer_handoff() - Hand off a pointer from RCU to other mechanism |
|
- | 771 | * @p: The pointer to hand off |
|
- | 772 | * |
|
- | 773 | * This is simply an identity function, but it documents where a pointer |
|
- | 774 | * is handed off from RCU to some other synchronization mechanism, for |
|
- | 775 | * example, reference counting or locking. In C11, it would map to |
|
- | 776 | * kill_dependency(). It could be used as follows: |
|
- | 777 | * |
|
- | 778 | * rcu_read_lock(); |
|
- | 779 | * p = rcu_dereference(gp); |
|
- | 780 | * long_lived = is_long_lived(p); |
|
- | 781 | * if (long_lived) { |
|
- | 782 | * if (!atomic_inc_not_zero(p->refcnt)) |
|
- | 783 | * long_lived = false; |
|
- | 784 | * else |
|
- | 785 | * p = rcu_pointer_handoff(p); |
|
- | 786 | * } |
|
- | 787 | * rcu_read_unlock(); |
|
- | 788 | */ |
|
- | 789 | #define rcu_pointer_handoff(p) (p) |
|
- | 790 | ||
756 | /** |
791 | /** |
757 | * rcu_read_lock() - mark the beginning of an RCU read-side critical section |
792 | * rcu_read_lock() - mark the beginning of an RCU read-side critical section |
758 | * |
793 | * |
759 | * When synchronize_rcu() is invoked on one CPU while other CPUs |
794 | * When synchronize_rcu() is invoked on one CPU while other CPUs |
760 | * are within RCU read-side critical sections, then the |
795 | * are within RCU read-side critical sections, then the |
Line 983... | Line 1018... | ||
983 | * ordering guarantees for either the CPU or the compiler. |
1018 | * ordering guarantees for either the CPU or the compiler. |
984 | */ |
1019 | */ |
985 | #define RCU_INIT_POINTER(p, v) \ |
1020 | #define RCU_INIT_POINTER(p, v) \ |
986 | do { \ |
1021 | do { \ |
987 | rcu_dereference_sparse(p, __rcu); \ |
1022 | rcu_dereference_sparse(p, __rcu); \ |
988 | p = RCU_INITIALIZER(v); \ |
1023 | WRITE_ONCE(p, RCU_INITIALIZER(v)); \ |
989 | } while (0) |
1024 | } while (0) |
Line 990... | Line 1025... | ||
990 | 1025 | ||
991 | /** |
1026 | /** |
992 | * RCU_POINTER_INITIALIZER() - statically initialize an RCU protected pointer |
1027 | * RCU_POINTER_INITIALIZER() - statically initialize an RCU protected pointer |