diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/ksysfs.c | 18 | ||||
| -rw-r--r-- | kernel/rcu.h | 2 | ||||
| -rw-r--r-- | kernel/rcupdate.c | 3 | ||||
| -rw-r--r-- | kernel/rcutiny.c | 2 | ||||
| -rw-r--r-- | kernel/rcutiny_plugin.h | 5 | ||||
| -rw-r--r-- | kernel/rcutorture.c | 45 | ||||
| -rw-r--r-- | kernel/rcutree.c | 124 | ||||
| -rw-r--r-- | kernel/rcutree_plugin.h | 15 | ||||
| -rw-r--r-- | kernel/sched/core.c | 8 | ||||
| -rw-r--r-- | kernel/srcu.c | 16 | 
10 files changed, 172 insertions, 66 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 4e316e1acf5..8715a798aa7 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -141,6 +141,23 @@ static ssize_t fscaps_show(struct kobject *kobj,  }  KERNEL_ATTR_RO(fscaps); +int rcu_expedited; +static ssize_t rcu_expedited_show(struct kobject *kobj, +				  struct kobj_attribute *attr, char *buf) +{ +	return sprintf(buf, "%d\n", rcu_expedited); +} +static ssize_t rcu_expedited_store(struct kobject *kobj, +				   struct kobj_attribute *attr, +				   const char *buf, size_t count) +{ +	if (kstrtoint(buf, 0, &rcu_expedited)) +		return -EINVAL; + +	return count; +} +KERNEL_ATTR_RW(rcu_expedited); +  /*   * Make /sys/kernel/notes give the raw contents of our kernel .notes section.   */ @@ -182,6 +199,7 @@ static struct attribute * kernel_attrs[] = {  	&kexec_crash_size_attr.attr,  	&vmcoreinfo_attr.attr,  #endif +	&rcu_expedited_attr.attr,  	NULL  }; diff --git a/kernel/rcu.h b/kernel/rcu.h index 8ba99cdc651..20dfba576c2 100644 --- a/kernel/rcu.h +++ b/kernel/rcu.h @@ -109,4 +109,6 @@ static inline bool __rcu_reclaim(char *rn, struct rcu_head *head)  	}  } +extern int rcu_expedited; +  #endif /* __LINUX_RCU_H */ diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 29ca1c6da59..a2cf76177b4 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c @@ -46,12 +46,15 @@  #include <linux/export.h>  #include <linux/hardirq.h>  #include <linux/delay.h> +#include <linux/module.h>  #define CREATE_TRACE_POINTS  #include <trace/events/rcu.h>  #include "rcu.h" +module_param(rcu_expedited, int, 0); +  #ifdef CONFIG_PREEMPT_RCU  /* diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index e4c6a598d6f..e7dce58f9c2 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c @@ -195,7 +195,7 @@ EXPORT_SYMBOL(rcu_is_cpu_idle);   */  int rcu_is_cpu_rrupt_from_idle(void)  { -	return rcu_dynticks_nesting <= 0; +	return rcu_dynticks_nesting <= 1;  }  /* diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h index 3d019028220..f85016a2309 100644 --- a/kernel/rcutiny_plugin.h +++ b/kernel/rcutiny_plugin.h @@ -706,7 +706,10 @@ void synchronize_rcu(void)  		return;  	/* Once we get past the fastpath checks, same code as rcu_barrier(). */ -	rcu_barrier(); +	if (rcu_expedited) +		synchronize_rcu_expedited(); +	else +		rcu_barrier();  }  EXPORT_SYMBOL_GPL(synchronize_rcu); diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 9900f560f1b..31dea01c85f 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c @@ -339,7 +339,6 @@ rcu_stutter_wait(char *title)  struct rcu_torture_ops {  	void (*init)(void); -	void (*cleanup)(void);  	int (*readlock)(void);  	void (*read_delay)(struct rcu_random_state *rrsp);  	void (*readunlock)(int idx); @@ -431,7 +430,6 @@ static void rcu_torture_deferred_free(struct rcu_torture *p)  static struct rcu_torture_ops rcu_ops = {  	.init		= NULL, -	.cleanup	= NULL,  	.readlock	= rcu_torture_read_lock,  	.read_delay	= rcu_read_delay,  	.readunlock	= rcu_torture_read_unlock, @@ -475,7 +473,6 @@ static void rcu_sync_torture_init(void)  static struct rcu_torture_ops rcu_sync_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= rcu_torture_read_lock,  	.read_delay	= rcu_read_delay,  	.readunlock	= rcu_torture_read_unlock, @@ -493,7 +490,6 @@ static struct rcu_torture_ops rcu_sync_ops = {  static struct rcu_torture_ops rcu_expedited_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= rcu_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= rcu_torture_read_unlock, @@ -536,7 +532,6 @@ static void rcu_bh_torture_deferred_free(struct rcu_torture *p)  static struct rcu_torture_ops rcu_bh_ops = {  	.init		= NULL, -	.cleanup	= NULL,  	.readlock	= rcu_bh_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= rcu_bh_torture_read_unlock, @@ -553,7 +548,6 @@ static struct rcu_torture_ops rcu_bh_ops = {  static struct rcu_torture_ops rcu_bh_sync_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= rcu_bh_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= rcu_bh_torture_read_unlock, @@ -570,7 +564,6 @@ static struct rcu_torture_ops rcu_bh_sync_ops = {  static struct rcu_torture_ops rcu_bh_expedited_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= rcu_bh_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= rcu_bh_torture_read_unlock, @@ -589,19 +582,7 @@ static struct rcu_torture_ops rcu_bh_expedited_ops = {   * Definitions for srcu torture testing.   */ -static struct srcu_struct srcu_ctl; - -static void srcu_torture_init(void) -{ -	init_srcu_struct(&srcu_ctl); -	rcu_sync_torture_init(); -} - -static void srcu_torture_cleanup(void) -{ -	synchronize_srcu(&srcu_ctl); -	cleanup_srcu_struct(&srcu_ctl); -} +DEFINE_STATIC_SRCU(srcu_ctl);  static int srcu_torture_read_lock(void) __acquires(&srcu_ctl)  { @@ -672,8 +653,7 @@ static int srcu_torture_stats(char *page)  }  static struct rcu_torture_ops srcu_ops = { -	.init		= srcu_torture_init, -	.cleanup	= srcu_torture_cleanup, +	.init		= rcu_sync_torture_init,  	.readlock	= srcu_torture_read_lock,  	.read_delay	= srcu_read_delay,  	.readunlock	= srcu_torture_read_unlock, @@ -687,8 +667,7 @@ static struct rcu_torture_ops srcu_ops = {  };  static struct rcu_torture_ops srcu_sync_ops = { -	.init		= srcu_torture_init, -	.cleanup	= srcu_torture_cleanup, +	.init		= rcu_sync_torture_init,  	.readlock	= srcu_torture_read_lock,  	.read_delay	= srcu_read_delay,  	.readunlock	= srcu_torture_read_unlock, @@ -712,8 +691,7 @@ static void srcu_torture_read_unlock_raw(int idx) __releases(&srcu_ctl)  }  static struct rcu_torture_ops srcu_raw_ops = { -	.init		= srcu_torture_init, -	.cleanup	= srcu_torture_cleanup, +	.init		= rcu_sync_torture_init,  	.readlock	= srcu_torture_read_lock_raw,  	.read_delay	= srcu_read_delay,  	.readunlock	= srcu_torture_read_unlock_raw, @@ -727,8 +705,7 @@ static struct rcu_torture_ops srcu_raw_ops = {  };  static struct rcu_torture_ops srcu_raw_sync_ops = { -	.init		= srcu_torture_init, -	.cleanup	= srcu_torture_cleanup, +	.init		= rcu_sync_torture_init,  	.readlock	= srcu_torture_read_lock_raw,  	.read_delay	= srcu_read_delay,  	.readunlock	= srcu_torture_read_unlock_raw, @@ -747,8 +724,7 @@ static void srcu_torture_synchronize_expedited(void)  }  static struct rcu_torture_ops srcu_expedited_ops = { -	.init		= srcu_torture_init, -	.cleanup	= srcu_torture_cleanup, +	.init		= rcu_sync_torture_init,  	.readlock	= srcu_torture_read_lock,  	.read_delay	= srcu_read_delay,  	.readunlock	= srcu_torture_read_unlock, @@ -783,7 +759,6 @@ static void rcu_sched_torture_deferred_free(struct rcu_torture *p)  static struct rcu_torture_ops sched_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= sched_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= sched_torture_read_unlock, @@ -799,7 +774,6 @@ static struct rcu_torture_ops sched_ops = {  static struct rcu_torture_ops sched_sync_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= sched_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= sched_torture_read_unlock, @@ -814,7 +788,6 @@ static struct rcu_torture_ops sched_sync_ops = {  static struct rcu_torture_ops sched_expedited_ops = {  	.init		= rcu_sync_torture_init, -	.cleanup	= NULL,  	.readlock	= sched_torture_read_lock,  	.read_delay	= rcu_read_delay,  /* just reuse rcu's version. */  	.readunlock	= sched_torture_read_unlock, @@ -1396,12 +1369,16 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, char *tag)  		 "fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d "  		 "test_boost=%d/%d test_boost_interval=%d "  		 "test_boost_duration=%d shutdown_secs=%d " +		 "stall_cpu=%d stall_cpu_holdoff=%d " +		 "n_barrier_cbs=%d "  		 "onoff_interval=%d onoff_holdoff=%d\n",  		 torture_type, tag, nrealreaders, nfakewriters,  		 stat_interval, verbose, test_no_idle_hz, shuffle_interval,  		 stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter,  		 test_boost, cur_ops->can_boost,  		 test_boost_interval, test_boost_duration, shutdown_secs, +		 stall_cpu, stall_cpu_holdoff, +		 n_barrier_cbs,  		 onoff_interval, onoff_holdoff);  } @@ -1943,8 +1920,6 @@ rcu_torture_cleanup(void)  	rcu_torture_stats_print();  /* -After- the stats thread is stopped! */ -	if (cur_ops->cleanup) -		cur_ops->cleanup();  	if (atomic_read(&n_rcu_torture_error) || n_rcu_torture_barrier_error)  		rcu_torture_print_module_parms(cur_ops, "End of test: FAILURE");  	else if (n_online_successes != n_online_attempts || diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 8ed9c481db0..5ffadcc3bb2 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -212,13 +212,13 @@ DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {  #endif  }; -static int blimit = 10;		/* Maximum callbacks per rcu_do_batch. */ -static int qhimark = 10000;	/* If this many pending, ignore blimit. */ -static int qlowmark = 100;	/* Once only this many pending, use blimit. */ +static long blimit = 10;	/* Maximum callbacks per rcu_do_batch. */ +static long qhimark = 10000;	/* If this many pending, ignore blimit. */ +static long qlowmark = 100;	/* Once only this many pending, use blimit. */ -module_param(blimit, int, 0444); -module_param(qhimark, int, 0444); -module_param(qlowmark, int, 0444); +module_param(blimit, long, 0444); +module_param(qhimark, long, 0444); +module_param(qlowmark, long, 0444);  int rcu_cpu_stall_suppress __read_mostly; /* 1 = suppress stall warnings. */  int rcu_cpu_stall_timeout __read_mostly = CONFIG_RCU_CPU_STALL_TIMEOUT; @@ -313,7 +313,7 @@ static int  cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp)  {  	return *rdp->nxttail[RCU_DONE_TAIL + -			     ACCESS_ONCE(rsp->completed) != rdp->completed] && +			     (ACCESS_ONCE(rsp->completed) != rdp->completed)] &&  	       !rcu_gp_in_progress(rsp);  } @@ -873,6 +873,29 @@ static void record_gp_stall_check_time(struct rcu_state *rsp)  	rsp->jiffies_stall = jiffies + jiffies_till_stall_check();  } +/* + * Dump stacks of all tasks running on stalled CPUs.  This is a fallback + * for architectures that do not implement trigger_all_cpu_backtrace(). + * The NMI-triggered stack traces are more accurate because they are + * printed by the target CPU. + */ +static void rcu_dump_cpu_stacks(struct rcu_state *rsp) +{ +	int cpu; +	unsigned long flags; +	struct rcu_node *rnp; + +	rcu_for_each_leaf_node(rsp, rnp) { +		raw_spin_lock_irqsave(&rnp->lock, flags); +		if (rnp->qsmask != 0) { +			for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++) +				if (rnp->qsmask & (1UL << cpu)) +					dump_cpu_task(rnp->grplo + cpu); +		} +		raw_spin_unlock_irqrestore(&rnp->lock, flags); +	} +} +  static void print_other_cpu_stall(struct rcu_state *rsp)  {  	int cpu; @@ -880,6 +903,7 @@ static void print_other_cpu_stall(struct rcu_state *rsp)  	unsigned long flags;  	int ndetected = 0;  	struct rcu_node *rnp = rcu_get_root(rsp); +	long totqlen = 0;  	/* Only let one CPU complain about others per time interval. */ @@ -924,12 +948,15 @@ static void print_other_cpu_stall(struct rcu_state *rsp)  	raw_spin_unlock_irqrestore(&rnp->lock, flags);  	print_cpu_stall_info_end(); -	printk(KERN_CONT "(detected by %d, t=%ld jiffies)\n", -	       smp_processor_id(), (long)(jiffies - rsp->gp_start)); +	for_each_possible_cpu(cpu) +		totqlen += per_cpu_ptr(rsp->rda, cpu)->qlen; +	pr_cont("(detected by %d, t=%ld jiffies, g=%lu, c=%lu, q=%lu)\n", +	       smp_processor_id(), (long)(jiffies - rsp->gp_start), +	       rsp->gpnum, rsp->completed, totqlen);  	if (ndetected == 0)  		printk(KERN_ERR "INFO: Stall ended before state dump start\n");  	else if (!trigger_all_cpu_backtrace()) -		dump_stack(); +		rcu_dump_cpu_stacks(rsp);  	/* Complain about tasks blocking the grace period. */ @@ -940,8 +967,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp)  static void print_cpu_stall(struct rcu_state *rsp)  { +	int cpu;  	unsigned long flags;  	struct rcu_node *rnp = rcu_get_root(rsp); +	long totqlen = 0;  	/*  	 * OK, time to rat on ourselves... @@ -952,7 +981,10 @@ static void print_cpu_stall(struct rcu_state *rsp)  	print_cpu_stall_info_begin();  	print_cpu_stall_info(rsp, smp_processor_id());  	print_cpu_stall_info_end(); -	printk(KERN_CONT " (t=%lu jiffies)\n", jiffies - rsp->gp_start); +	for_each_possible_cpu(cpu) +		totqlen += per_cpu_ptr(rsp->rda, cpu)->qlen; +	pr_cont(" (t=%lu jiffies g=%lu c=%lu q=%lu)\n", +		jiffies - rsp->gp_start, rsp->gpnum, rsp->completed, totqlen);  	if (!trigger_all_cpu_backtrace())  		dump_stack(); @@ -1404,15 +1436,37 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)  	    !cpu_needs_another_gp(rsp, rdp)) {  		/*  		 * Either we have not yet spawned the grace-period -		 * task or this CPU does not need another grace period. +		 * task, this CPU does not need another grace period, +		 * or a grace period is already in progress.  		 * Either way, don't start a new grace period.  		 */  		raw_spin_unlock_irqrestore(&rnp->lock, flags);  		return;  	} +	/* +	 * Because there is no grace period in progress right now, +	 * any callbacks we have up to this point will be satisfied +	 * by the next grace period.  So promote all callbacks to be +	 * handled after the end of the next grace period.  If the +	 * CPU is not yet aware of the end of the previous grace period, +	 * we need to allow for the callback advancement that will +	 * occur when it does become aware.  Deadlock prevents us from +	 * making it aware at this point: We cannot acquire a leaf +	 * rcu_node ->lock while holding the root rcu_node ->lock. +	 */ +	rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL]; +	if (rdp->completed == rsp->completed) +		rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_TAIL]; +  	rsp->gp_flags = RCU_GP_FLAG_INIT; -	raw_spin_unlock_irqrestore(&rnp->lock, flags); +	raw_spin_unlock(&rnp->lock); /* Interrupts remain disabled. */ + +	/* Ensure that CPU is aware of completion of last grace period. */ +	rcu_process_gp_end(rsp, rdp); +	local_irq_restore(flags); + +	/* Wake up rcu_gp_kthread() to start the grace period. */  	wake_up(&rsp->gp_wq);  } @@ -1769,7 +1823,8 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)  {  	unsigned long flags;  	struct rcu_head *next, *list, **tail; -	int bl, count, count_lazy, i; +	long bl, count, count_lazy; +	int i;  	/* If no callbacks are ready, just return.*/  	if (!cpu_has_callbacks_ready_to_invoke(rdp)) { @@ -2205,10 +2260,28 @@ static inline int rcu_blocking_is_gp(void)   * rcu_read_lock_sched().   *   * This means that all preempt_disable code sequences, including NMI and - * hardware-interrupt handlers, in progress on entry will have completed - * before this primitive returns.  However, this does not guarantee that - * softirq handlers will have completed, since in some kernels, these - * handlers can run in process context, and can block. + * non-threaded hardware-interrupt handlers, in progress on entry will + * have completed before this primitive returns.  However, this does not + * guarantee that softirq handlers will have completed, since in some + * kernels, these handlers can run in process context, and can block. + * + * Note that this guarantee implies further memory-ordering guarantees. + * On systems with more than one CPU, when synchronize_sched() returns, + * each CPU is guaranteed to have executed a full memory barrier since the + * end of its last RCU-sched read-side critical section whose beginning + * preceded the call to synchronize_sched().  In addition, each CPU having + * an RCU read-side critical section that extends beyond the return from + * synchronize_sched() is guaranteed to have executed a full memory barrier + * after the beginning of synchronize_sched() and before the beginning of + * that RCU read-side critical section.  Note that these guarantees include + * CPUs that are offline, idle, or executing in user mode, as well as CPUs + * that are executing in the kernel. + * + * Furthermore, if CPU A invoked synchronize_sched(), which returned + * to its caller on CPU B, then both CPU A and CPU B are guaranteed + * to have executed a full memory barrier during the execution of + * synchronize_sched() -- even if CPU A and CPU B are the same CPU (but + * again only if the system has more than one CPU).   *   * This primitive provides the guarantees made by the (now removed)   * synchronize_kernel() API.  In contrast, synchronize_rcu() only @@ -2224,7 +2297,10 @@ void synchronize_sched(void)  			   "Illegal synchronize_sched() in RCU-sched read-side critical section");  	if (rcu_blocking_is_gp())  		return; -	wait_rcu_gp(call_rcu_sched); +	if (rcu_expedited) +		synchronize_sched_expedited(); +	else +		wait_rcu_gp(call_rcu_sched);  }  EXPORT_SYMBOL_GPL(synchronize_sched); @@ -2236,6 +2312,9 @@ EXPORT_SYMBOL_GPL(synchronize_sched);   * read-side critical sections have completed.  RCU read-side critical   * sections are delimited by rcu_read_lock_bh() and rcu_read_unlock_bh(),   * and may be nested. + * + * See the description of synchronize_sched() for more detailed information + * on memory ordering guarantees.   */  void synchronize_rcu_bh(void)  { @@ -2245,7 +2324,10 @@ void synchronize_rcu_bh(void)  			   "Illegal synchronize_rcu_bh() in RCU-bh read-side critical section");  	if (rcu_blocking_is_gp())  		return; -	wait_rcu_gp(call_rcu_bh); +	if (rcu_expedited) +		synchronize_rcu_bh_expedited(); +	else +		wait_rcu_gp(call_rcu_bh);  }  EXPORT_SYMBOL_GPL(synchronize_rcu_bh); @@ -2357,7 +2439,7 @@ void synchronize_sched_expedited(void)  		if (trycount++ < 10) {  			udelay(trycount * num_online_cpus());  		} else { -			synchronize_sched(); +			wait_rcu_gp(call_rcu_sched);  			atomic_long_inc(&rsp->expedited_normal);  			return;  		} diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h index 2b281cf0b6f..5ce3352505e 100644 --- a/kernel/rcutree_plugin.h +++ b/kernel/rcutree_plugin.h @@ -670,6 +670,9 @@ EXPORT_SYMBOL_GPL(kfree_call_rcu);   * concurrently with new RCU read-side critical sections that began while   * synchronize_rcu() was waiting.  RCU read-side critical sections are   * delimited by rcu_read_lock() and rcu_read_unlock(), and may be nested. + * + * See the description of synchronize_sched() for more detailed information + * on memory ordering guarantees.   */  void synchronize_rcu(void)  { @@ -679,7 +682,10 @@ void synchronize_rcu(void)  			   "Illegal synchronize_rcu() in RCU read-side critical section");  	if (!rcu_scheduler_active)  		return; -	wait_rcu_gp(call_rcu); +	if (rcu_expedited) +		synchronize_rcu_expedited(); +	else +		wait_rcu_gp(call_rcu);  }  EXPORT_SYMBOL_GPL(synchronize_rcu); @@ -832,7 +838,7 @@ void synchronize_rcu_expedited(void)  			udelay(trycount * num_online_cpus());  		} else {  			put_online_cpus(); -			synchronize_rcu(); +			wait_rcu_gp(call_rcu);  			return;  		}  	} @@ -876,6 +882,11 @@ EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);  /**   * rcu_barrier - Wait until all in-flight call_rcu() callbacks complete. + * + * Note that this primitive does not necessarily wait for an RCU grace period + * to complete.  For example, if there are no RCU callbacks queued anywhere + * in the system, then rcu_barrier() is within its rights to return + * immediately, without waiting for anything, much less an RCU grace period.   */  void rcu_barrier(void)  { diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2d8927fda71..6d4569e0924 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1887,7 +1887,7 @@ context_switch(struct rq *rq, struct task_struct *prev,  #endif  	/* Here we just switch the register state and the stack. */ -	rcu_switch(prev, next); +	rcu_user_hooks_switch(prev, next);  	switch_to(prev, next, prev);  	barrier(); @@ -8076,3 +8076,9 @@ struct cgroup_subsys cpuacct_subsys = {  	.base_cftypes = files,  };  #endif	/* CONFIG_CGROUP_CPUACCT */ + +void dump_cpu_task(int cpu) +{ +	pr_info("Task dump for CPU %d:\n", cpu); +	sched_show_task(cpu_curr(cpu)); +} diff --git a/kernel/srcu.c b/kernel/srcu.c index 97c465ebd84..2b859828cdc 100644 --- a/kernel/srcu.c +++ b/kernel/srcu.c @@ -16,8 +16,10 @@   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.   *   * Copyright (C) IBM Corporation, 2006 + * Copyright (C) Fujitsu, 2012   *   * Author: Paul McKenney <paulmck@us.ibm.com> + *	   Lai Jiangshan <laijs@cn.fujitsu.com>   *   * For detailed explanation of Read-Copy Update mechanism see -   * 		Documentation/RCU/ *.txt @@ -34,6 +36,10 @@  #include <linux/delay.h>  #include <linux/srcu.h> +#include <trace/events/rcu.h> + +#include "rcu.h" +  /*   * Initialize an rcu_batch structure to empty.   */ @@ -92,9 +98,6 @@ static inline void rcu_batch_move(struct rcu_batch *to, struct rcu_batch *from)  	}  } -/* single-thread state-machine */ -static void process_srcu(struct work_struct *work); -  static int init_srcu_struct_fields(struct srcu_struct *sp)  {  	sp->completed = 0; @@ -464,7 +467,9 @@ static void __synchronize_srcu(struct srcu_struct *sp, int trycount)   */  void synchronize_srcu(struct srcu_struct *sp)  { -	__synchronize_srcu(sp, SYNCHRONIZE_SRCU_TRYCOUNT); +	__synchronize_srcu(sp, rcu_expedited +			   ? SYNCHRONIZE_SRCU_EXP_TRYCOUNT +			   : SYNCHRONIZE_SRCU_TRYCOUNT);  }  EXPORT_SYMBOL_GPL(synchronize_srcu); @@ -637,7 +642,7 @@ static void srcu_reschedule(struct srcu_struct *sp)  /*   * This is the work-queue function that handles SRCU grace periods.   */ -static void process_srcu(struct work_struct *work) +void process_srcu(struct work_struct *work)  {  	struct srcu_struct *sp; @@ -648,3 +653,4 @@ static void process_srcu(struct work_struct *work)  	srcu_invoke_callbacks(sp);  	srcu_reschedule(sp);  } +EXPORT_SYMBOL_GPL(process_srcu);  |