Skip to content

Commit fe24a0b

Browse files
committed
Merge branches 'doc.2023.07.14b', 'fixes.2023.08.16a', 'rcu-tasks.2023.07.24a', 'rcuscale.2023.07.14b', 'refscale.2023.07.14b', 'torture.2023.08.14a' and 'torturescripts.2023.07.20a' into HEAD
doc.2023.07.14b: Documentation updates. fixes.2023.08.16a: Miscellaneous fixes. rcu-tasks.2023.07.24a: RCU Tasks updates. rcuscale.2023.07.14b: RCU (updater) scalability test updates. refscale.2023.07.14b: Reference (reader) scalability test updates. torture.2023.08.14a: Other torture-test updates. torturescripts.2023.07.20a: Other torture-test scripting updates.
7 parents 47d63d7 + efd04f8 + 9d0cce2 + 8afeb54 + b5a2801 + bc19e86 + 7c25ee8 commit fe24a0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+608
-1759
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2918,6 +2918,10 @@
29182918
locktorture.torture_type= [KNL]
29192919
Specify the locking implementation to test.
29202920

2921+
locktorture.writer_fifo= [KNL]
2922+
Run the write-side locktorture kthreads at
2923+
sched_set_fifo() real-time priority.
2924+
29212925
locktorture.verbose= [KNL]
29222926
Enable additional printk() statements.
29232927

@@ -4928,6 +4932,15 @@
49284932
test until boot completes in order to avoid
49294933
interference.
49304934

4935+
rcuscale.kfree_by_call_rcu= [KNL]
4936+
In kernels built with CONFIG_RCU_LAZY=y, test
4937+
call_rcu() instead of kfree_rcu().
4938+
4939+
rcuscale.kfree_mult= [KNL]
4940+
Instead of allocating an object of size kfree_obj,
4941+
allocate one of kfree_mult * sizeof(kfree_obj).
4942+
Defaults to 1.
4943+
49314944
rcuscale.kfree_rcu_test= [KNL]
49324945
Set to measure performance of kfree_rcu() flooding.
49334946

@@ -4953,6 +4966,12 @@
49534966
Number of loops doing rcuscale.kfree_alloc_num number
49544967
of allocations and frees.
49554968

4969+
rcuscale.minruntime= [KNL]
4970+
Set the minimum test run time in seconds. This
4971+
does not affect the data-collection interval,
4972+
but instead allows better measurement of things
4973+
like CPU consumption.
4974+
49564975
rcuscale.nreaders= [KNL]
49574976
Set number of RCU readers. The value -1 selects
49584977
N, where N is the number of CPUs. A value
@@ -4967,7 +4986,7 @@
49674986
the same as for rcuscale.nreaders.
49684987
N, where N is the number of CPUs
49694988

4970-
rcuscale.perf_type= [KNL]
4989+
rcuscale.scale_type= [KNL]
49714990
Specify the RCU implementation to test.
49724991

49734992
rcuscale.shutdown= [KNL]
@@ -4983,6 +5002,11 @@
49835002
in microseconds. The default of zero says
49845003
no holdoff.
49855004

5005+
rcuscale.writer_holdoff_jiffies= [KNL]
5006+
Additional write-side holdoff between grace
5007+
periods, but in jiffies. The default of zero
5008+
says no holdoff.
5009+
49865010
rcutorture.fqs_duration= [KNL]
49875011
Set duration of force_quiescent_state bursts
49885012
in microseconds.
@@ -5264,6 +5288,13 @@
52645288
number avoids disturbing real-time workloads,
52655289
but lengthens grace periods.
52665290

5291+
rcupdate.rcu_task_lazy_lim= [KNL]
5292+
Number of callbacks on a given CPU that will
5293+
cancel laziness on that CPU. Use -1 to disable
5294+
cancellation of laziness, but be advised that
5295+
doing so increases the danger of OOM due to
5296+
callback flooding.
5297+
52675298
rcupdate.rcu_task_stall_info= [KNL]
52685299
Set initial timeout in jiffies for RCU task stall
52695300
informational messages, which give some indication
@@ -5293,6 +5324,29 @@
52935324
A change in value does not take effect until
52945325
the beginning of the next grace period.
52955326

5327+
rcupdate.rcu_tasks_lazy_ms= [KNL]
5328+
Set timeout in milliseconds RCU Tasks asynchronous
5329+
callback batching for call_rcu_tasks().
5330+
A negative value will take the default. A value
5331+
of zero will disable batching. Batching is
5332+
always disabled for synchronize_rcu_tasks().
5333+
5334+
rcupdate.rcu_tasks_rude_lazy_ms= [KNL]
5335+
Set timeout in milliseconds RCU Tasks
5336+
Rude asynchronous callback batching for
5337+
call_rcu_tasks_rude(). A negative value
5338+
will take the default. A value of zero will
5339+
disable batching. Batching is always disabled
5340+
for synchronize_rcu_tasks_rude().
5341+
5342+
rcupdate.rcu_tasks_trace_lazy_ms= [KNL]
5343+
Set timeout in milliseconds RCU Tasks
5344+
Trace asynchronous callback batching for
5345+
call_rcu_tasks_trace(). A negative value
5346+
will take the default. A value of zero will
5347+
disable batching. Batching is always disabled
5348+
for synchronize_rcu_tasks_trace().
5349+
52965350
rcupdate.rcu_self_test= [KNL]
52975351
Run the RCU early boot self tests
52985352

include/linux/notifier.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ struct raw_notifier_head {
7373

7474
struct srcu_notifier_head {
7575
struct mutex mutex;
76-
#ifdef CONFIG_TREE_SRCU
7776
struct srcu_usage srcuu;
78-
#endif
7977
struct srcu_struct srcu;
8078
struct notifier_block __rcu *head;
8179
};
@@ -106,22 +104,13 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
106104
#define RAW_NOTIFIER_INIT(name) { \
107105
.head = NULL }
108106

109-
#ifdef CONFIG_TREE_SRCU
110107
#define SRCU_NOTIFIER_INIT(name, pcpu) \
111108
{ \
112109
.mutex = __MUTEX_INITIALIZER(name.mutex), \
113110
.head = NULL, \
114111
.srcuu = __SRCU_USAGE_INIT(name.srcuu), \
115112
.srcu = __SRCU_STRUCT_INIT(name.srcu, name.srcuu, pcpu), \
116113
}
117-
#else
118-
#define SRCU_NOTIFIER_INIT(name, pcpu) \
119-
{ \
120-
.mutex = __MUTEX_INITIALIZER(name.mutex), \
121-
.head = NULL, \
122-
.srcu = __SRCU_STRUCT_INIT(name.srcu, name.srcuu, pcpu), \
123-
}
124-
#endif
125114

126115
#define ATOMIC_NOTIFIER_HEAD(name) \
127116
struct atomic_notifier_head name = \

include/linux/rculist_nulls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
101101
{
102102
struct hlist_nulls_node *first = h->first;
103103

104-
n->next = first;
104+
WRITE_ONCE(n->next, first);
105105
WRITE_ONCE(n->pprev, &h->first);
106106
rcu_assign_pointer(hlist_nulls_first_rcu(h), n);
107107
if (!is_a_nulls(first))
@@ -137,7 +137,7 @@ static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n,
137137
last = i;
138138

139139
if (last) {
140-
n->next = last->next;
140+
WRITE_ONCE(n->next, last->next);
141141
n->pprev = &last->next;
142142
rcu_assign_pointer(hlist_nulls_next_rcu(last), n);
143143
} else {

include/linux/rcupdate_trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static inline void rcu_read_unlock_trace(void)
8787
void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
8888
void synchronize_rcu_tasks_trace(void);
8989
void rcu_barrier_tasks_trace(void);
90+
struct task_struct *get_rcu_tasks_trace_gp_kthread(void);
9091
#else
9192
/*
9293
* The BPF JIT forms these addresses even when it doesn't call these

include/linux/rcupdate_wait.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ do { \
4242
* call_srcu() function, with this wrapper supplying the pointer to the
4343
* corresponding srcu_struct.
4444
*
45+
* Note that call_rcu_hurry() should be used instead of call_rcu()
46+
* because in kernels built with CONFIG_RCU_LAZY=y the delay between the
47+
* invocation of call_rcu() and that of the corresponding RCU callback
48+
* can be multiple seconds.
49+
*
4550
* The first argument tells Tiny RCU's _wait_rcu_gp() not to
4651
* bother waiting for RCU. The reason for this is because anywhere
4752
* synchronize_rcu_mult() can be called is automatically already a full

include/linux/srcutiny.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ void srcu_drive_gp(struct work_struct *wp);
4848
#define DEFINE_STATIC_SRCU(name) \
4949
static struct srcu_struct name = __SRCU_STRUCT_INIT(name, name, name)
5050

51+
// Dummy structure for srcu_notifier_head.
52+
struct srcu_usage { };
53+
#define __SRCU_USAGE_INIT(name) { }
54+
5155
void synchronize_srcu(struct srcu_struct *ssp);
5256

5357
/*

include/linux/torture.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ bool torture_must_stop(void);
108108
bool torture_must_stop_irq(void);
109109
void torture_kthread_stopping(char *title);
110110
int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
111-
char *f, struct task_struct **tp);
111+
char *f, struct task_struct **tp, void (*cbf)(struct task_struct *tp));
112112
void _torture_stop_kthread(char *m, struct task_struct **tp);
113113

114114
#define torture_create_kthread(n, arg, tp) \
115115
_torture_create_kthread(n, (arg), #n, "Creating " #n " task", \
116-
"Failed to create " #n, &(tp))
116+
"Failed to create " #n, &(tp), NULL)
117+
#define torture_create_kthread_cb(n, arg, tp, cbf) \
118+
_torture_create_kthread(n, (arg), #n, "Creating " #n " task", \
119+
"Failed to create " #n, &(tp), cbf)
117120
#define torture_stop_kthread(n, tp) \
118121
_torture_stop_kthread("Stopping " #n " task", &(tp))
119122

kernel/locking/locktorture.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable");
4545
torture_param(int, rt_boost, 2,
4646
"Do periodic rt-boost. 0=Disable, 1=Only for rt_mutex, 2=For all lock types.");
4747
torture_param(int, rt_boost_factor, 50, "A factor determining how often rt-boost happens.");
48+
torture_param(int, writer_fifo, 0, "Run writers at sched_set_fifo() priority");
4849
torture_param(int, verbose, 1, "Enable verbose debugging printk()s");
4950
torture_param(int, nested_locks, 0, "Number of nested locks (max = 8)");
5051
/* Going much higher trips "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" errors */
@@ -809,7 +810,8 @@ static int lock_torture_writer(void *arg)
809810
bool skip_main_lock;
810811

811812
VERBOSE_TOROUT_STRING("lock_torture_writer task started");
812-
set_user_nice(current, MAX_NICE);
813+
if (!rt_task(current))
814+
set_user_nice(current, MAX_NICE);
813815

814816
do {
815817
if ((torture_random(&rand) & 0xfffff) == 0)
@@ -1015,8 +1017,7 @@ static void lock_torture_cleanup(void)
10151017

10161018
if (writer_tasks) {
10171019
for (i = 0; i < cxt.nrealwriters_stress; i++)
1018-
torture_stop_kthread(lock_torture_writer,
1019-
writer_tasks[i]);
1020+
torture_stop_kthread(lock_torture_writer, writer_tasks[i]);
10201021
kfree(writer_tasks);
10211022
writer_tasks = NULL;
10221023
}
@@ -1244,8 +1245,9 @@ static int __init lock_torture_init(void)
12441245
goto create_reader;
12451246

12461247
/* Create writer. */
1247-
firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i],
1248-
writer_tasks[i]);
1248+
firsterr = torture_create_kthread_cb(lock_torture_writer, &cxt.lwsa[i],
1249+
writer_tasks[i],
1250+
writer_fifo ? sched_set_fifo : NULL);
12491251
if (torture_init_error(firsterr))
12501252
goto unwind;
12511253

kernel/rcu/rcu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,14 @@ static inline void show_rcu_tasks_gp_kthreads(void) {}
511511
void rcu_request_urgent_qs_task(struct task_struct *t);
512512
#endif /* #else #ifdef CONFIG_TINY_RCU */
513513

514+
#ifdef CONFIG_TASKS_RCU
515+
struct task_struct *get_rcu_tasks_gp_kthread(void);
516+
#endif // # ifdef CONFIG_TASKS_RCU
517+
518+
#ifdef CONFIG_TASKS_RUDE_RCU
519+
struct task_struct *get_rcu_tasks_rude_gp_kthread(void);
520+
#endif // # ifdef CONFIG_TASKS_RUDE_RCU
521+
514522
#define RCU_SCHEDULER_INACTIVE 0
515523
#define RCU_SCHEDULER_INIT 1
516524
#define RCU_SCHEDULER_RUNNING 2

0 commit comments

Comments
 (0)