]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - include/linux/rcu_segcblist.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * RCU segmented callback lists
5 * This seemingly RCU-private file must be available to SRCU users
6 * because the size of the TREE SRCU srcu_struct structure depends
7 * on these definitions.
9 * Copyright IBM Corporation, 2017
11 * Authors: Paul E. McKenney <paulmck@linux.net.ibm.com>
14 #ifndef __INCLUDE_LINUX_RCU_SEGCBLIST_H
15 #define __INCLUDE_LINUX_RCU_SEGCBLIST_H
17 /* Simple unsegmented callback lists. */
19 struct rcu_head
*head
;
20 struct rcu_head
**tail
;
25 #define RCU_CBLIST_INITIALIZER(n) { .head = NULL, .tail = &n.head }
27 /* Complicated segmented callback lists. ;-) */
30 * Index values for segments in rcu_segcblist structure.
32 * The segments are as follows:
34 * [head, *tails[RCU_DONE_TAIL]):
35 * Callbacks whose grace period has elapsed, and thus can be invoked.
36 * [*tails[RCU_DONE_TAIL], *tails[RCU_WAIT_TAIL]):
37 * Callbacks waiting for the current GP from the current CPU's viewpoint.
38 * [*tails[RCU_WAIT_TAIL], *tails[RCU_NEXT_READY_TAIL]):
39 * Callbacks that arrived before the next GP started, again from
40 * the current CPU's viewpoint. These can be handled by the next GP.
41 * [*tails[RCU_NEXT_READY_TAIL], *tails[RCU_NEXT_TAIL]):
42 * Callbacks that might have arrived after the next GP started.
43 * There is some uncertainty as to when a given GP starts and
44 * ends, but a CPU knows the exact times if it is the one starting
45 * or ending the GP. Other CPUs know that the previous GP ends
46 * before the next one starts.
48 * Note that RCU_WAIT_TAIL cannot be empty unless RCU_NEXT_READY_TAIL is also
51 * The ->gp_seq[] array contains the grace-period number at which the
52 * corresponding segment of callbacks will be ready to invoke. A given
53 * element of this array is meaningful only when the corresponding segment
54 * is non-empty, and it is never valid for RCU_DONE_TAIL (whose callbacks
55 * are already ready to invoke) or for RCU_NEXT_TAIL (whose callbacks have
56 * not yet been assigned a grace-period number).
58 #define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
59 #define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
60 #define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
61 #define RCU_NEXT_TAIL 3
62 #define RCU_CBLIST_NSEGS 4
64 struct rcu_segcblist
{
65 struct rcu_head
*head
;
66 struct rcu_head
**tails
[RCU_CBLIST_NSEGS
];
67 unsigned long gp_seq
[RCU_CBLIST_NSEGS
];
72 #define RCU_SEGCBLIST_INITIALIZER(n) \
75 .tails[RCU_DONE_TAIL] = &n.head, \
76 .tails[RCU_WAIT_TAIL] = &n.head, \
77 .tails[RCU_NEXT_READY_TAIL] = &n.head, \
78 .tails[RCU_NEXT_TAIL] = &n.head, \
81 #endif /* __INCLUDE_LINUX_RCU_SEGCBLIST_H */