Skip to content

Commit 0e24738

Browse files
committed
Merge branches 'doc.2019.12.10a', 'exp.2019.12.09a', 'fixes.2020.01.24a', 'kfree_rcu.2020.01.24a', 'list.2020.01.10a', 'preempt.2020.01.24a' and 'torture.2019.12.09a' into HEAD
doc.2019.12.10a: Documentations updates exp.2019.12.09a: Expedited grace-period updates fixes.2020.01.24a: Miscellaneous fixes kfree_rcu.2020.01.24a: Batch kfree_rcu() work list.2020.01.10a: RCU-protected-list updates preempt.2020.01.24a: Preemptible RCU updates torture.2019.12.09a: Torture-test updates
7 parents 6e6eca2 + df1e849 + f6105fc + 189a688 + afa47fd + 5b14557 + b22eb7c commit 0e24738

39 files changed

+1070
-575
lines changed

.mailmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ Paolo 'Blaisorblade' Giarrusso <[email protected]>
207207
Patrick Mochel <[email protected]>
208208
209209
210+
211+
212+
213+
210214
Peter A Jonsson <[email protected]>
211215
Peter Oruba <[email protected]>
212216
Peter Oruba <[email protected]>

Documentation/RCU/stallwarn.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,13 @@ an estimate of the total number of RCU callbacks queued across all CPUs
225225
In kernels with CONFIG_RCU_FAST_NO_HZ, more information is printed
226226
for each CPU:
227227

228-
0: (64628 ticks this GP) idle=dd5/3fffffffffffffff/0 softirq=82/543 last_accelerate: a345/d342 Nonlazy posted: ..D
228+
0: (64628 ticks this GP) idle=dd5/3fffffffffffffff/0 softirq=82/543 last_accelerate: a345/d342 dyntick_enabled: 1
229229

230230
The "last_accelerate:" prints the low-order 16 bits (in hex) of the
231231
jiffies counter when this CPU last invoked rcu_try_advance_all_cbs()
232232
from rcu_needs_cpu() or last invoked rcu_accelerate_cbs() from
233-
rcu_prepare_for_idle(). The "Nonlazy posted:" indicates lazy-callback
234-
status, so that an "l" indicates that all callbacks were lazy at the start
235-
of the last idle period and an "L" indicates that there are currently
236-
no non-lazy callbacks (in both cases, "." is printed otherwise, as
237-
shown above) and "D" indicates that dyntick-idle processing is enabled
238-
("." is printed otherwise, for example, if disabled via the "nohz="
239-
kernel boot parameter).
233+
rcu_prepare_for_idle(). "dyntick_enabled: 1" indicates that dyntick-idle
234+
processing is enabled.
240235

241236
If the grace period ends just as the stall warning starts printing,
242237
there will be a spurious stall-warning message, which will include

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3978,6 +3978,19 @@
39783978
test until boot completes in order to avoid
39793979
interference.
39803980

3981+
rcuperf.kfree_rcu_test= [KNL]
3982+
Set to measure performance of kfree_rcu() flooding.
3983+
3984+
rcuperf.kfree_nthreads= [KNL]
3985+
The number of threads running loops of kfree_rcu().
3986+
3987+
rcuperf.kfree_alloc_num= [KNL]
3988+
Number of allocations and frees done in an iteration.
3989+
3990+
rcuperf.kfree_loops= [KNL]
3991+
Number of loops doing rcuperf.kfree_alloc_num number
3992+
of allocations and frees.
3993+
39813994
rcuperf.nreaders= [KNL]
39823995
Set number of RCU readers. The value -1 selects
39833996
N, where N is the number of CPUs. A value

arch/powerpc/include/asm/barrier.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* mb() prevents loads and stores being reordered across this point.
1919
* rmb() prevents loads being reordered across this point.
2020
* wmb() prevents stores being reordered across this point.
21-
* read_barrier_depends() prevents data-dependent loads being reordered
22-
* across this point (nop on PPC).
2321
*
2422
* *mb() variants without smp_ prefix must order all types of memory
2523
* operations with one another. sync is the only instruction sufficient

drivers/net/wireless/mediatek/mt76/agg-rx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ void mt76_rx_aggr_stop(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno)
281281
{
282282
struct mt76_rx_tid *tid = NULL;
283283

284-
rcu_swap_protected(wcid->aggr[tidno], tid,
285-
lockdep_is_held(&dev->mutex));
284+
tid = rcu_replace_pointer(wcid->aggr[tidno], tid,
285+
lockdep_is_held(&dev->mutex));
286286
if (tid) {
287287
mt76_rx_aggr_shutdown(dev, tid);
288288
kfree_rcu(tid, rcu_head);

include/linux/list.h

Lines changed: 112 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
#define LIST_HEAD(name) \
2424
struct list_head name = LIST_HEAD_INIT(name)
2525

26+
/**
27+
* INIT_LIST_HEAD - Initialize a list_head structure
28+
* @list: list_head structure to be initialized.
29+
*
30+
* Initializes the list_head to point to itself. If it is a list header,
31+
* the result is an empty list.
32+
*/
2633
static inline void INIT_LIST_HEAD(struct list_head *list)
2734
{
2835
WRITE_ONCE(list->next, list);
@@ -120,12 +127,6 @@ static inline void __list_del_clearprev(struct list_head *entry)
120127
entry->prev = NULL;
121128
}
122129

123-
/**
124-
* list_del - deletes entry from list.
125-
* @entry: the element to delete from the list.
126-
* Note: list_empty() on entry does not return true after this, the entry is
127-
* in an undefined state.
128-
*/
129130
static inline void __list_del_entry(struct list_head *entry)
130131
{
131132
if (!__list_del_entry_valid(entry))
@@ -134,6 +135,12 @@ static inline void __list_del_entry(struct list_head *entry)
134135
__list_del(entry->prev, entry->next);
135136
}
136137

138+
/**
139+
* list_del - deletes entry from list.
140+
* @entry: the element to delete from the list.
141+
* Note: list_empty() on entry does not return true after this, the entry is
142+
* in an undefined state.
143+
*/
137144
static inline void list_del(struct list_head *entry)
138145
{
139146
__list_del_entry(entry);
@@ -157,8 +164,15 @@ static inline void list_replace(struct list_head *old,
157164
new->prev->next = new;
158165
}
159166

167+
/**
168+
* list_replace_init - replace old entry by new one and initialize the old one
169+
* @old : the element to be replaced
170+
* @new : the new element to insert
171+
*
172+
* If @old was empty, it will be overwritten.
173+
*/
160174
static inline void list_replace_init(struct list_head *old,
161-
struct list_head *new)
175+
struct list_head *new)
162176
{
163177
list_replace(old, new);
164178
INIT_LIST_HEAD(old);
@@ -744,11 +758,36 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h)
744758
h->pprev = NULL;
745759
}
746760

761+
/**
762+
* hlist_unhashed - Has node been removed from list and reinitialized?
763+
* @h: Node to be checked
764+
*
765+
* Not that not all removal functions will leave a node in unhashed
766+
* state. For example, hlist_nulls_del_init_rcu() does leave the
767+
* node in unhashed state, but hlist_nulls_del() does not.
768+
*/
747769
static inline int hlist_unhashed(const struct hlist_node *h)
748770
{
749771
return !h->pprev;
750772
}
751773

774+
/**
775+
* hlist_unhashed_lockless - Version of hlist_unhashed for lockless use
776+
* @h: Node to be checked
777+
*
778+
* This variant of hlist_unhashed() must be used in lockless contexts
779+
* to avoid potential load-tearing. The READ_ONCE() is paired with the
780+
* various WRITE_ONCE() in hlist helpers that are defined below.
781+
*/
782+
static inline int hlist_unhashed_lockless(const struct hlist_node *h)
783+
{
784+
return !READ_ONCE(h->pprev);
785+
}
786+
787+
/**
788+
* hlist_empty - Is the specified hlist_head structure an empty hlist?
789+
* @h: Structure to check.
790+
*/
752791
static inline int hlist_empty(const struct hlist_head *h)
753792
{
754793
return !READ_ONCE(h->first);
@@ -761,16 +800,29 @@ static inline void __hlist_del(struct hlist_node *n)
761800

762801
WRITE_ONCE(*pprev, next);
763802
if (next)
764-
next->pprev = pprev;
803+
WRITE_ONCE(next->pprev, pprev);
765804
}
766805

806+
/**
807+
* hlist_del - Delete the specified hlist_node from its list
808+
* @n: Node to delete.
809+
*
810+
* Note that this function leaves the node in hashed state. Use
811+
* hlist_del_init() or similar instead to unhash @n.
812+
*/
767813
static inline void hlist_del(struct hlist_node *n)
768814
{
769815
__hlist_del(n);
770816
n->next = LIST_POISON1;
771817
n->pprev = LIST_POISON2;
772818
}
773819

820+
/**
821+
* hlist_del_init - Delete the specified hlist_node from its list and initialize
822+
* @n: Node to delete.
823+
*
824+
* Note that this function leaves the node in unhashed state.
825+
*/
774826
static inline void hlist_del_init(struct hlist_node *n)
775827
{
776828
if (!hlist_unhashed(n)) {
@@ -779,59 +831,95 @@ static inline void hlist_del_init(struct hlist_node *n)
779831
}
780832
}
781833

834+
/**
835+
* hlist_add_head - add a new entry at the beginning of the hlist
836+
* @n: new entry to be added
837+
* @h: hlist head to add it after
838+
*
839+
* Insert a new entry after the specified head.
840+
* This is good for implementing stacks.
841+
*/
782842
static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
783843
{
784844
struct hlist_node *first = h->first;
785-
n->next = first;
845+
WRITE_ONCE(n->next, first);
786846
if (first)
787-
first->pprev = &n->next;
847+
WRITE_ONCE(first->pprev, &n->next);
788848
WRITE_ONCE(h->first, n);
789-
n->pprev = &h->first;
849+
WRITE_ONCE(n->pprev, &h->first);
790850
}
791851

792-
/* next must be != NULL */
852+
/**
853+
* hlist_add_before - add a new entry before the one specified
854+
* @n: new entry to be added
855+
* @next: hlist node to add it before, which must be non-NULL
856+
*/
793857
static inline void hlist_add_before(struct hlist_node *n,
794-
struct hlist_node *next)
858+
struct hlist_node *next)
795859
{
796-
n->pprev = next->pprev;
797-
n->next = next;
798-
next->pprev = &n->next;
860+
WRITE_ONCE(n->pprev, next->pprev);
861+
WRITE_ONCE(n->next, next);
862+
WRITE_ONCE(next->pprev, &n->next);
799863
WRITE_ONCE(*(n->pprev), n);
800864
}
801865

866+
/**
867+
* hlist_add_behing - add a new entry after the one specified
868+
* @n: new entry to be added
869+
* @prev: hlist node to add it after, which must be non-NULL
870+
*/
802871
static inline void hlist_add_behind(struct hlist_node *n,
803872
struct hlist_node *prev)
804873
{
805-
n->next = prev->next;
806-
prev->next = n;
807-
n->pprev = &prev->next;
874+
WRITE_ONCE(n->next, prev->next);
875+
WRITE_ONCE(prev->next, n);
876+
WRITE_ONCE(n->pprev, &prev->next);
808877

809878
if (n->next)
810-
n->next->pprev = &n->next;
879+
WRITE_ONCE(n->next->pprev, &n->next);
811880
}
812881

813-
/* after that we'll appear to be on some hlist and hlist_del will work */
882+
/**
883+
* hlist_add_fake - create a fake hlist consisting of a single headless node
884+
* @n: Node to make a fake list out of
885+
*
886+
* This makes @n appear to be its own predecessor on a headless hlist.
887+
* The point of this is to allow things like hlist_del() to work correctly
888+
* in cases where there is no list.
889+
*/
814890
static inline void hlist_add_fake(struct hlist_node *n)
815891
{
816892
n->pprev = &n->next;
817893
}
818894

895+
/**
896+
* hlist_fake: Is this node a fake hlist?
897+
* @h: Node to check for being a self-referential fake hlist.
898+
*/
819899
static inline bool hlist_fake(struct hlist_node *h)
820900
{
821901
return h->pprev == &h->next;
822902
}
823903

824-
/*
904+
/**
905+
* hlist_is_singular_node - is node the only element of the specified hlist?
906+
* @n: Node to check for singularity.
907+
* @h: Header for potentially singular list.
908+
*
825909
* Check whether the node is the only node of the head without
826-
* accessing head:
910+
* accessing head, thus avoiding unnecessary cache misses.
827911
*/
828912
static inline bool
829913
hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h)
830914
{
831915
return !n->next && n->pprev == &h->first;
832916
}
833917

834-
/*
918+
/**
919+
* hlist_move_list - Move an hlist
920+
* @old: hlist_head for old list.
921+
* @new: hlist_head for new list.
922+
*
835923
* Move a list from one list head to another. Fixup the pprev
836924
* reference of the first entry if it exists.
837925
*/

include/linux/list_nulls.h

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,33 @@ static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr)
5656
return ((unsigned long)ptr) >> 1;
5757
}
5858

59+
/**
60+
* hlist_nulls_unhashed - Has node been removed and reinitialized?
61+
* @h: Node to be checked
62+
*
63+
* Not that not all removal functions will leave a node in unhashed state.
64+
* For example, hlist_del_init_rcu() leaves the node in unhashed state,
65+
* but hlist_nulls_del() does not.
66+
*/
5967
static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
6068
{
6169
return !h->pprev;
6270
}
6371

72+
/**
73+
* hlist_nulls_unhashed_lockless - Has node been removed and reinitialized?
74+
* @h: Node to be checked
75+
*
76+
* Not that not all removal functions will leave a node in unhashed state.
77+
* For example, hlist_del_init_rcu() leaves the node in unhashed state,
78+
* but hlist_nulls_del() does not. Unlike hlist_nulls_unhashed(), this
79+
* function may be used locklessly.
80+
*/
81+
static inline int hlist_nulls_unhashed_lockless(const struct hlist_nulls_node *h)
82+
{
83+
return !READ_ONCE(h->pprev);
84+
}
85+
6486
static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
6587
{
6688
return is_a_nulls(READ_ONCE(h->first));
@@ -72,10 +94,10 @@ static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,
7294
struct hlist_nulls_node *first = h->first;
7395

7496
n->next = first;
75-
n->pprev = &h->first;
97+
WRITE_ONCE(n->pprev, &h->first);
7698
h->first = n;
7799
if (!is_a_nulls(first))
78-
first->pprev = &n->next;
100+
WRITE_ONCE(first->pprev, &n->next);
79101
}
80102

81103
static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
@@ -85,13 +107,13 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
85107

86108
WRITE_ONCE(*pprev, next);
87109
if (!is_a_nulls(next))
88-
next->pprev = pprev;
110+
WRITE_ONCE(next->pprev, pprev);
89111
}
90112

91113
static inline void hlist_nulls_del(struct hlist_nulls_node *n)
92114
{
93115
__hlist_nulls_del(n);
94-
n->pprev = LIST_POISON2;
116+
WRITE_ONCE(n->pprev, LIST_POISON2);
95117
}
96118

97119
/**

include/linux/rcu_segcblist.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct rcu_cblist {
2222
struct rcu_head *head;
2323
struct rcu_head **tail;
2424
long len;
25-
long len_lazy;
2625
};
2726

2827
#define RCU_CBLIST_INITIALIZER(n) { .head = NULL, .tail = &n.head }
@@ -73,7 +72,6 @@ struct rcu_segcblist {
7372
#else
7473
long len;
7574
#endif
76-
long len_lazy;
7775
u8 enabled;
7876
u8 offloaded;
7977
};

0 commit comments

Comments
 (0)