Skip to content

Commit 13625c0

Browse files
committed
Merge branches 'doc.2020.06.29a', 'fixes.2020.06.29a', 'kfree_rcu.2020.06.29a', 'rcu-tasks.2020.06.29a', 'scale.2020.06.29a', 'srcu.2020.06.29a' and 'torture.2020.06.29a' into HEAD
doc.2020.06.29a: Documentation updates. fixes.2020.06.29a: Miscellaneous fixes. kfree_rcu.2020.06.29a: kfree_rcu() updates. rcu-tasks.2020.06.29a: RCU Tasks updates. scale.2020.06.29a: Read-side scalability tests. srcu.2020.06.29a: SRCU updates. torture.2020.06.29a: Torture-test updates.
7 parents d93d97c + 24692fa + da4fc00 + 30d8aa5 + f71d831 + bde50d8 + 7a6bbea commit 13625c0

Some content is hidden

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

47 files changed

+1886
-267
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,6 +4038,14 @@
40384038
latencies, which will choose a value aligned
40394039
with the appropriate hardware boundaries.
40404040

4041+
rcutree.rcu_min_cached_objs= [KNL]
4042+
Minimum number of objects which are cached and
4043+
maintained per one CPU. Object size is equal
4044+
to PAGE_SIZE. The cache allows to reduce the
4045+
pressure to page allocator, also it makes the
4046+
whole algorithm to behave better in low memory
4047+
condition.
4048+
40414049
rcutree.jiffies_till_first_fqs= [KNL]
40424050
Set delay from grace-period initialization to
40434051
first attempt to force quiescent states.
@@ -4258,6 +4266,20 @@
42584266
Set time (jiffies) between CPU-hotplug operations,
42594267
or zero to disable CPU-hotplug testing.
42604268

4269+
rcutorture.read_exit= [KNL]
4270+
Set the number of read-then-exit kthreads used
4271+
to test the interaction of RCU updaters and
4272+
task-exit processing.
4273+
4274+
rcutorture.read_exit_burst= [KNL]
4275+
The number of times in a given read-then-exit
4276+
episode that a set of read-then-exit kthreads
4277+
is spawned.
4278+
4279+
rcutorture.read_exit_delay= [KNL]
4280+
The delay, in seconds, between successive
4281+
read-then-exit testing episodes.
4282+
42614283
rcutorture.shuffle_interval= [KNL]
42624284
Set task-shuffle interval (s). Shuffling tasks
42634285
allows some CPUs to go into dyntick-idle mode
@@ -4407,6 +4429,45 @@
44074429
reboot_cpu is s[mp]#### with #### being the processor
44084430
to be used for rebooting.
44094431

4432+
refscale.holdoff= [KNL]
4433+
Set test-start holdoff period. The purpose of
4434+
this parameter is to delay the start of the
4435+
test until boot completes in order to avoid
4436+
interference.
4437+
4438+
refscale.loops= [KNL]
4439+
Set the number of loops over the synchronization
4440+
primitive under test. Increasing this number
4441+
reduces noise due to loop start/end overhead,
4442+
but the default has already reduced the per-pass
4443+
noise to a handful of picoseconds on ca. 2020
4444+
x86 laptops.
4445+
4446+
refscale.nreaders= [KNL]
4447+
Set number of readers. The default value of -1
4448+
selects N, where N is roughly 75% of the number
4449+
of CPUs. A value of zero is an interesting choice.
4450+
4451+
refscale.nruns= [KNL]
4452+
Set number of runs, each of which is dumped onto
4453+
the console log.
4454+
4455+
refscale.readdelay= [KNL]
4456+
Set the read-side critical-section duration,
4457+
measured in microseconds.
4458+
4459+
refscale.scale_type= [KNL]
4460+
Specify the read-protection implementation to test.
4461+
4462+
refscale.shutdown= [KNL]
4463+
Shut down the system at the end of the performance
4464+
test. This defaults to 1 (shut it down) when
4465+
rcuperf is built into the kernel and to 0 (leave
4466+
it running) when rcuperf is built as a module.
4467+
4468+
refscale.verbose= [KNL]
4469+
Enable additional printk() statements.
4470+
44104471
relax_domain_level=
44114472
[KNL, SMP] Set scheduler's default relax_domain_level.
44124473
See Documentation/admin-guide/cgroup-v1/cpusets.rst.
@@ -5082,6 +5143,13 @@
50825143
Prevent the CPU-hotplug component of torturing
50835144
until after init has spawned.
50845145

5146+
torture.ftrace_dump_at_shutdown= [KNL]
5147+
Dump the ftrace buffer at torture-test shutdown,
5148+
even if there were no errors. This can be a
5149+
very costly operation when many torture tests
5150+
are running concurrently, especially on systems
5151+
with rotating-rust storage.
5152+
50855153
tp720= [HW,PS2]
50865154

50875155
tpm_suspend_pcr=[HW,TPM]

fs/btrfs/extent_io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4515,6 +4515,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask)
45154515

45164516
/* once for us */
45174517
free_extent_map(em);
4518+
4519+
cond_resched(); /* Allow large-extent preemption. */
45184520
}
45194521
}
45204522
return try_release_extent_state(tree, page, mask);

include/linux/rculist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static inline void hlist_replace_rcu(struct hlist_node *old,
512512
* @right: The hlist head on the right
513513
*
514514
* The lists start out as [@left ][node1 ... ] and
515-
[@right ][node2 ... ]
515+
* [@right ][node2 ... ]
516516
* The lists end up as [@left ][node2 ... ]
517517
* [@right ][node1 ... ]
518518
*/

include/linux/rcupdate.h

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -828,17 +828,17 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
828828

829829
/*
830830
* Does the specified offset indicate that the corresponding rcu_head
831-
* structure can be handled by kfree_rcu()?
831+
* structure can be handled by kvfree_rcu()?
832832
*/
833-
#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
833+
#define __is_kvfree_rcu_offset(offset) ((offset) < 4096)
834834

835835
/*
836836
* Helper macro for kfree_rcu() to prevent argument-expansion eyestrain.
837837
*/
838-
#define __kfree_rcu(head, offset) \
838+
#define __kvfree_rcu(head, offset) \
839839
do { \
840-
BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
841-
kfree_call_rcu(head, (rcu_callback_t)(unsigned long)(offset)); \
840+
BUILD_BUG_ON(!__is_kvfree_rcu_offset(offset)); \
841+
kvfree_call_rcu(head, (rcu_callback_t)(unsigned long)(offset)); \
842842
} while (0)
843843

844844
/**
@@ -857,7 +857,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
857857
* Because the functions are not allowed in the low-order 4096 bytes of
858858
* kernel virtual memory, offsets up to 4095 bytes can be accommodated.
859859
* If the offset is larger than 4095 bytes, a compile-time error will
860-
* be generated in __kfree_rcu(). If this error is triggered, you can
860+
* be generated in __kvfree_rcu(). If this error is triggered, you can
861861
* either fall back to use of call_rcu() or rearrange the structure to
862862
* position the rcu_head structure into the first 4096 bytes.
863863
*
@@ -872,7 +872,46 @@ do { \
872872
typeof (ptr) ___p = (ptr); \
873873
\
874874
if (___p) \
875-
__kfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \
875+
__kvfree_rcu(&((___p)->rhf), offsetof(typeof(*(ptr)), rhf)); \
876+
} while (0)
877+
878+
/**
879+
* kvfree_rcu() - kvfree an object after a grace period.
880+
*
881+
* This macro consists of one or two arguments and it is
882+
* based on whether an object is head-less or not. If it
883+
* has a head then a semantic stays the same as it used
884+
* to be before:
885+
*
886+
* kvfree_rcu(ptr, rhf);
887+
*
888+
* where @ptr is a pointer to kvfree(), @rhf is the name
889+
* of the rcu_head structure within the type of @ptr.
890+
*
891+
* When it comes to head-less variant, only one argument
892+
* is passed and that is just a pointer which has to be
893+
* freed after a grace period. Therefore the semantic is
894+
*
895+
* kvfree_rcu(ptr);
896+
*
897+
* where @ptr is a pointer to kvfree().
898+
*
899+
* Please note, head-less way of freeing is permitted to
900+
* use from a context that has to follow might_sleep()
901+
* annotation. Otherwise, please switch and embed the
902+
* rcu_head structure within the type of @ptr.
903+
*/
904+
#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__, \
905+
kvfree_rcu_arg_2, kvfree_rcu_arg_1)(__VA_ARGS__)
906+
907+
#define KVFREE_GET_MACRO(_1, _2, NAME, ...) NAME
908+
#define kvfree_rcu_arg_2(ptr, rhf) kfree_rcu(ptr, rhf)
909+
#define kvfree_rcu_arg_1(ptr) \
910+
do { \
911+
typeof(ptr) ___p = (ptr); \
912+
\
913+
if (___p) \
914+
kvfree_call_rcu(NULL, (rcu_callback_t) (___p)); \
876915
} while (0)
877916

878917
/*

include/linux/rcupdate_trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ void rcu_read_unlock_trace_special(struct task_struct *t, int nesting);
3636
/**
3737
* rcu_read_lock_trace - mark beginning of RCU-trace read-side critical section
3838
*
39-
* When synchronize_rcu_trace() is invoked by one task, then that task
40-
* is guaranteed to block until all other tasks exit their read-side
39+
* When synchronize_rcu_tasks_trace() is invoked by one task, then that
40+
* task is guaranteed to block until all other tasks exit their read-side
4141
* critical sections. Similarly, if call_rcu_trace() is invoked on one
4242
* task while other tasks are within RCU read-side critical sections,
4343
* invocation of the corresponding RCU callback is deferred until after

include/linux/rcutiny.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,25 @@ static inline void synchronize_rcu_expedited(void)
3434
synchronize_rcu();
3535
}
3636

37-
static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
37+
/*
38+
* Add one more declaration of kvfree() here. It is
39+
* not so straight forward to just include <linux/mm.h>
40+
* where it is defined due to getting many compile
41+
* errors caused by that include.
42+
*/
43+
extern void kvfree(const void *addr);
44+
45+
static inline void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
3846
{
39-
call_rcu(head, func);
47+
if (head) {
48+
call_rcu(head, func);
49+
return;
50+
}
51+
52+
// kvfree_rcu(one_arg) call.
53+
might_sleep();
54+
synchronize_rcu();
55+
kvfree((void *) func);
4056
}
4157

4258
void rcu_qs(void);

include/linux/rcutree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static inline void rcu_virt_note_context_switch(int cpu)
3333
}
3434

3535
void synchronize_rcu_expedited(void);
36-
void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
36+
void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
3737

3838
void rcu_barrier(void);
3939
bool rcu_eqs_special_set(int cpu);

include/linux/torture.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ struct torture_random_state {
5555
#define DEFINE_TORTURE_RANDOM_PERCPU(name) \
5656
DEFINE_PER_CPU(struct torture_random_state, name)
5757
unsigned long torture_random(struct torture_random_state *trsp);
58+
static inline void torture_random_init(struct torture_random_state *trsp)
59+
{
60+
trsp->trs_state = 0;
61+
trsp->trs_count = 0;
62+
}
5863

5964
/* Task shuffler, which causes CPUs to occasionally go idle. */
6065
void torture_shuffle_task_register(struct task_struct *tp);

include/trace/events/rcu.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,12 @@ TRACE_EVENT_RCU(rcu_fqs,
435435
#endif /* #if defined(CONFIG_TREE_RCU) */
436436

437437
/*
438-
* Tracepoint for dyntick-idle entry/exit events. These take a string
439-
* as argument: "Start" for entering dyntick-idle mode, "Startirq" for
440-
* entering it from irq/NMI, "End" for leaving it, "Endirq" for leaving it
441-
* to irq/NMI, "--=" for events moving towards idle, and "++=" for events
442-
* moving away from idle.
438+
* Tracepoint for dyntick-idle entry/exit events. These take 2 strings
439+
* as argument:
440+
* polarity: "Start", "End", "StillNonIdle" for entering, exiting or still not
441+
* being in dyntick-idle mode.
442+
* context: "USER" or "IDLE" or "IRQ".
443+
* NMIs nested in IRQs are inferred with dynticks_nesting > 1 in IRQ context.
443444
*
444445
* These events also take a pair of numbers, which indicate the nesting
445446
* depth before and after the event of interest, and a third number that is
@@ -506,13 +507,13 @@ TRACE_EVENT_RCU(rcu_callback,
506507

507508
/*
508509
* Tracepoint for the registration of a single RCU callback of the special
509-
* kfree() form. The first argument is the RCU type, the second argument
510+
* kvfree() form. The first argument is the RCU type, the second argument
510511
* is a pointer to the RCU callback, the third argument is the offset
511512
* of the callback within the enclosing RCU-protected data structure,
512513
* the fourth argument is the number of lazy callbacks queued, and the
513514
* fifth argument is the total number of callbacks queued.
514515
*/
515-
TRACE_EVENT_RCU(rcu_kfree_callback,
516+
TRACE_EVENT_RCU(rcu_kvfree_callback,
516517

517518
TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
518519
long qlen),
@@ -596,12 +597,12 @@ TRACE_EVENT_RCU(rcu_invoke_callback,
596597

597598
/*
598599
* Tracepoint for the invocation of a single RCU callback of the special
599-
* kfree() form. The first argument is the RCU flavor, the second
600+
* kvfree() form. The first argument is the RCU flavor, the second
600601
* argument is a pointer to the RCU callback, and the third argument
601602
* is the offset of the callback within the enclosing RCU-protected
602603
* data structure.
603604
*/
604-
TRACE_EVENT_RCU(rcu_invoke_kfree_callback,
605+
TRACE_EVENT_RCU(rcu_invoke_kvfree_callback,
605606

606607
TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
607608

kernel/locking/lockdep.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5851,9 +5851,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
58515851
pr_warn("\n%srcu_scheduler_active = %d, debug_locks = %d\n",
58525852
!rcu_lockdep_current_cpu_online()
58535853
? "RCU used illegally from offline CPU!\n"
5854-
: !rcu_is_watching()
5855-
? "RCU used illegally from idle CPU!\n"
5856-
: "",
5854+
: "",
58575855
rcu_scheduler_active, debug_locks);
58585856

58595857
/*

0 commit comments

Comments
 (0)