diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/rculist.h | 17 | ||||
| -rw-r--r-- | include/linux/rcupdate.h | 94 | ||||
| -rw-r--r-- | include/linux/rcutiny.h | 10 | ||||
| -rw-r--r-- | include/linux/rcutree.h | 6 | ||||
| -rw-r--r-- | include/linux/srcu.h | 4 |
5 files changed, 65 insertions, 66 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index dbaf99084112..8183b46fbaa2 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
| @@ -247,9 +247,10 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
| 247 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). | 247 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). |
| 248 | */ | 248 | */ |
| 249 | #define list_entry_rcu(ptr, type, member) \ | 249 | #define list_entry_rcu(ptr, type, member) \ |
| 250 | ({typeof (*ptr) __rcu *__ptr = (typeof (*ptr) __rcu __force *)ptr; \ | 250 | ({ \ |
| 251 | container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ | 251 | typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \ |
| 252 | }) | 252 | container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ |
| 253 | }) | ||
| 253 | 254 | ||
| 254 | /** | 255 | /** |
| 255 | * Where are list_empty_rcu() and list_first_entry_rcu()? | 256 | * Where are list_empty_rcu() and list_first_entry_rcu()? |
| @@ -285,11 +286,11 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
| 285 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). | 286 | * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). |
| 286 | */ | 287 | */ |
| 287 | #define list_first_or_null_rcu(ptr, type, member) \ | 288 | #define list_first_or_null_rcu(ptr, type, member) \ |
| 288 | ({struct list_head *__ptr = (ptr); \ | 289 | ({ \ |
| 289 | struct list_head *__next = ACCESS_ONCE(__ptr->next); \ | 290 | struct list_head *__ptr = (ptr); \ |
| 290 | likely(__ptr != __next) ? \ | 291 | struct list_head *__next = ACCESS_ONCE(__ptr->next); \ |
| 291 | list_entry_rcu(__next, type, member) : NULL; \ | 292 | likely(__ptr != __next) ? list_entry_rcu(__next, type, member) : NULL; \ |
| 292 | }) | 293 | }) |
| 293 | 294 | ||
| 294 | /** | 295 | /** |
| 295 | * list_for_each_entry_rcu - iterate over rcu list of given type | 296 | * list_for_each_entry_rcu - iterate over rcu list of given type |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 72bf3a01a4ee..cda2583d67e9 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, you can access it online at |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * | 17 | * |
| 18 | * Copyright IBM Corporation, 2001 | 18 | * Copyright IBM Corporation, 2001 |
| 19 | * | 19 | * |
| @@ -44,7 +44,9 @@ | |||
| 44 | #include <linux/debugobjects.h> | 44 | #include <linux/debugobjects.h> |
| 45 | #include <linux/bug.h> | 45 | #include <linux/bug.h> |
| 46 | #include <linux/compiler.h> | 46 | #include <linux/compiler.h> |
| 47 | #include <asm/barrier.h> | ||
| 47 | 48 | ||
| 49 | extern int rcu_expedited; /* for sysctl */ | ||
| 48 | #ifdef CONFIG_RCU_TORTURE_TEST | 50 | #ifdef CONFIG_RCU_TORTURE_TEST |
| 49 | extern int rcutorture_runnable; /* for sysctl */ | 51 | extern int rcutorture_runnable; /* for sysctl */ |
| 50 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ | 52 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ |
| @@ -479,11 +481,9 @@ static inline void rcu_preempt_sleep_check(void) | |||
| 479 | do { \ | 481 | do { \ |
| 480 | rcu_preempt_sleep_check(); \ | 482 | rcu_preempt_sleep_check(); \ |
| 481 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ | 483 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ |
| 482 | "Illegal context switch in RCU-bh" \ | 484 | "Illegal context switch in RCU-bh read-side critical section"); \ |
| 483 | " read-side critical section"); \ | ||
| 484 | rcu_lockdep_assert(!lock_is_held(&rcu_sched_lock_map), \ | 485 | rcu_lockdep_assert(!lock_is_held(&rcu_sched_lock_map), \ |
| 485 | "Illegal context switch in RCU-sched"\ | 486 | "Illegal context switch in RCU-sched read-side critical section"); \ |
| 486 | " read-side critical section"); \ | ||
| 487 | } while (0) | 487 | } while (0) |
| 488 | 488 | ||
| 489 | #else /* #ifdef CONFIG_PROVE_RCU */ | 489 | #else /* #ifdef CONFIG_PROVE_RCU */ |
| @@ -510,43 +510,40 @@ static inline void rcu_preempt_sleep_check(void) | |||
| 510 | #endif /* #else #ifdef __CHECKER__ */ | 510 | #endif /* #else #ifdef __CHECKER__ */ |
| 511 | 511 | ||
| 512 | #define __rcu_access_pointer(p, space) \ | 512 | #define __rcu_access_pointer(p, space) \ |
| 513 | ({ \ | 513 | ({ \ |
| 514 | typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \ | 514 | typeof(*p) *_________p1 = (typeof(*p) *__force)ACCESS_ONCE(p); \ |
| 515 | rcu_dereference_sparse(p, space); \ | 515 | rcu_dereference_sparse(p, space); \ |
| 516 | ((typeof(*p) __force __kernel *)(_________p1)); \ | 516 | ((typeof(*p) __force __kernel *)(_________p1)); \ |
| 517 | }) | 517 | }) |
| 518 | #define __rcu_dereference_check(p, c, space) \ | 518 | #define __rcu_dereference_check(p, c, space) \ |
| 519 | ({ \ | 519 | ({ \ |
| 520 | typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \ | 520 | typeof(*p) *_________p1 = (typeof(*p) *__force)ACCESS_ONCE(p); \ |
| 521 | rcu_lockdep_assert(c, "suspicious rcu_dereference_check()" \ | 521 | rcu_lockdep_assert(c, "suspicious rcu_dereference_check() usage"); \ |
| 522 | " usage"); \ | 522 | rcu_dereference_sparse(p, space); \ |
| 523 | rcu_dereference_sparse(p, space); \ | 523 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ |
| 524 | smp_read_barrier_depends(); \ | 524 | ((typeof(*p) __force __kernel *)(_________p1)); \ |
| 525 | ((typeof(*p) __force __kernel *)(_________p1)); \ | 525 | }) |
| 526 | }) | ||
| 527 | #define __rcu_dereference_protected(p, c, space) \ | 526 | #define __rcu_dereference_protected(p, c, space) \ |
| 528 | ({ \ | 527 | ({ \ |
| 529 | rcu_lockdep_assert(c, "suspicious rcu_dereference_protected()" \ | 528 | rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ |
| 530 | " usage"); \ | 529 | rcu_dereference_sparse(p, space); \ |
| 531 | rcu_dereference_sparse(p, space); \ | 530 | ((typeof(*p) __force __kernel *)(p)); \ |
| 532 | ((typeof(*p) __force __kernel *)(p)); \ | 531 | }) |
| 533 | }) | ||
| 534 | 532 | ||
| 535 | #define __rcu_access_index(p, space) \ | 533 | #define __rcu_access_index(p, space) \ |
| 536 | ({ \ | 534 | ({ \ |
| 537 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | 535 | typeof(p) _________p1 = ACCESS_ONCE(p); \ |
| 538 | rcu_dereference_sparse(p, space); \ | 536 | rcu_dereference_sparse(p, space); \ |
| 539 | (_________p1); \ | 537 | (_________p1); \ |
| 540 | }) | 538 | }) |
| 541 | #define __rcu_dereference_index_check(p, c) \ | 539 | #define __rcu_dereference_index_check(p, c) \ |
| 542 | ({ \ | 540 | ({ \ |
| 543 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | 541 | typeof(p) _________p1 = ACCESS_ONCE(p); \ |
| 544 | rcu_lockdep_assert(c, \ | 542 | rcu_lockdep_assert(c, \ |
| 545 | "suspicious rcu_dereference_index_check()" \ | 543 | "suspicious rcu_dereference_index_check() usage"); \ |
| 546 | " usage"); \ | 544 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ |
| 547 | smp_read_barrier_depends(); \ | 545 | (_________p1); \ |
| 548 | (_________p1); \ | 546 | }) |
| 549 | }) | ||
| 550 | 547 | ||
| 551 | /** | 548 | /** |
| 552 | * RCU_INITIALIZER() - statically initialize an RCU-protected global variable | 549 | * RCU_INITIALIZER() - statically initialize an RCU-protected global variable |
| @@ -585,12 +582,7 @@ static inline void rcu_preempt_sleep_check(void) | |||
| 585 | * please be careful when making changes to rcu_assign_pointer() and the | 582 | * please be careful when making changes to rcu_assign_pointer() and the |
| 586 | * other macros that it invokes. | 583 | * other macros that it invokes. |
| 587 | */ | 584 | */ |
| 588 | #define rcu_assign_pointer(p, v) \ | 585 | #define rcu_assign_pointer(p, v) smp_store_release(&p, RCU_INITIALIZER(v)) |
| 589 | do { \ | ||
| 590 | smp_wmb(); \ | ||
| 591 | ACCESS_ONCE(p) = RCU_INITIALIZER(v); \ | ||
| 592 | } while (0) | ||
| 593 | |||
| 594 | 586 | ||
| 595 | /** | 587 | /** |
| 596 | * rcu_access_pointer() - fetch RCU pointer with no dereferencing | 588 | * rcu_access_pointer() - fetch RCU pointer with no dereferencing |
| @@ -1015,11 +1007,21 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
| 1015 | #define kfree_rcu(ptr, rcu_head) \ | 1007 | #define kfree_rcu(ptr, rcu_head) \ |
| 1016 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) | 1008 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) |
| 1017 | 1009 | ||
| 1018 | #ifdef CONFIG_RCU_NOCB_CPU | 1010 | #if defined(CONFIG_TINY_RCU) || defined(CONFIG_RCU_NOCB_CPU_ALL) |
| 1011 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | ||
| 1012 | { | ||
| 1013 | *delta_jiffies = ULONG_MAX; | ||
| 1014 | return 0; | ||
| 1015 | } | ||
| 1016 | #endif /* #if defined(CONFIG_TINY_RCU) || defined(CONFIG_RCU_NOCB_CPU_ALL) */ | ||
| 1017 | |||
| 1018 | #if defined(CONFIG_RCU_NOCB_CPU_ALL) | ||
| 1019 | static inline bool rcu_is_nocb_cpu(int cpu) { return true; } | ||
| 1020 | #elif defined(CONFIG_RCU_NOCB_CPU) | ||
| 1019 | bool rcu_is_nocb_cpu(int cpu); | 1021 | bool rcu_is_nocb_cpu(int cpu); |
| 1020 | #else | 1022 | #else |
| 1021 | static inline bool rcu_is_nocb_cpu(int cpu) { return false; } | 1023 | static inline bool rcu_is_nocb_cpu(int cpu) { return false; } |
| 1022 | #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ | 1024 | #endif |
| 1023 | 1025 | ||
| 1024 | 1026 | ||
| 1025 | /* Only for use by adaptive-ticks code. */ | 1027 | /* Only for use by adaptive-ticks code. */ |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 6f01771b571c..e8cb6e3b52a7 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, you can access it online at |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * | 17 | * |
| 18 | * Copyright IBM Corporation, 2008 | 18 | * Copyright IBM Corporation, 2008 |
| 19 | * | 19 | * |
| @@ -68,12 +68,6 @@ static inline void kfree_call_rcu(struct rcu_head *head, | |||
| 68 | call_rcu(head, func); | 68 | call_rcu(head, func); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) | ||
| 72 | { | ||
| 73 | *delta_jiffies = ULONG_MAX; | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline void rcu_note_context_switch(int cpu) | 71 | static inline void rcu_note_context_switch(int cpu) |
| 78 | { | 72 | { |
| 79 | rcu_sched_qs(cpu); | 73 | rcu_sched_qs(cpu); |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 72137ee8c603..e9c63884df0a 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, you can access it online at |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * | 17 | * |
| 18 | * Copyright IBM Corporation, 2008 | 18 | * Copyright IBM Corporation, 2008 |
| 19 | * | 19 | * |
| @@ -31,7 +31,9 @@ | |||
| 31 | #define __LINUX_RCUTREE_H | 31 | #define __LINUX_RCUTREE_H |
| 32 | 32 | ||
| 33 | void rcu_note_context_switch(int cpu); | 33 | void rcu_note_context_switch(int cpu); |
| 34 | #ifndef CONFIG_RCU_NOCB_CPU_ALL | ||
| 34 | int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); | 35 | int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); |
| 36 | #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */ | ||
| 35 | void rcu_cpu_stall_reset(void); | 37 | void rcu_cpu_stall_reset(void); |
| 36 | 38 | ||
| 37 | /* | 39 | /* |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 9b058eecd403..a2783cb5d275 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, you can access it online at |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * http://www.gnu.org/licenses/gpl-2.0.html. |
| 17 | * | 17 | * |
| 18 | * Copyright (C) IBM Corporation, 2006 | 18 | * Copyright (C) IBM Corporation, 2006 |
| 19 | * Copyright (C) Fujitsu, 2012 | 19 | * Copyright (C) Fujitsu, 2012 |
