aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-07-21 14:26:54 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-09-16 13:08:02 -0400
commit417e8d26557c4264a484d78a7491316751afa46f (patch)
tree87f3b5b1da73ec208f2e55341a4d68102a3c88f7 /kernel
parent22c2f669611590b428647ac9a73bc63ef3989d4b (diff)
rcu: Eliminate redundant rcu_sysidle_state variable
Now that we have rcu_state_p, which references rcu_preempt_state for TREE_PREEMPT_RCU and rcu_sched_state for TREE_RCU, we don't need a separate rcu_sysidle_state variable. This commit therefore eliminates rcu_preempt_state in favor of rcu_state_p. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Pranith Kumar <bobby.prani@gmail.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcu/tree_plugin.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 39e68bcf6d83..3ddad4fb11a8 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2690,16 +2690,6 @@ static void __maybe_unused rcu_kick_nohz_cpu(int cpu)
2690 2690
2691#ifdef CONFIG_NO_HZ_FULL_SYSIDLE 2691#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
2692 2692
2693/*
2694 * Define RCU flavor that holds sysidle state. This needs to be the
2695 * most active flavor of RCU.
2696 */
2697#ifdef CONFIG_PREEMPT_RCU
2698static struct rcu_state *rcu_sysidle_state = &rcu_preempt_state;
2699#else /* #ifdef CONFIG_PREEMPT_RCU */
2700static struct rcu_state *rcu_sysidle_state = &rcu_sched_state;
2701#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
2702
2703static int full_sysidle_state; /* Current system-idle state. */ 2693static int full_sysidle_state; /* Current system-idle state. */
2704#define RCU_SYSIDLE_NOT 0 /* Some CPU is not idle. */ 2694#define RCU_SYSIDLE_NOT 0 /* Some CPU is not idle. */
2705#define RCU_SYSIDLE_SHORT 1 /* All CPUs idle for brief period. */ 2695#define RCU_SYSIDLE_SHORT 1 /* All CPUs idle for brief period. */
@@ -2841,7 +2831,7 @@ static void rcu_sysidle_check_cpu(struct rcu_data *rdp, bool *isidle,
2841 * not the flavor of RCU that tracks sysidle state, or if this 2831 * not the flavor of RCU that tracks sysidle state, or if this
2842 * is an offline or the timekeeping CPU, nothing to do. 2832 * is an offline or the timekeeping CPU, nothing to do.
2843 */ 2833 */
2844 if (!*isidle || rdp->rsp != rcu_sysidle_state || 2834 if (!*isidle || rdp->rsp != rcu_state_p ||
2845 cpu_is_offline(rdp->cpu) || rdp->cpu == tick_do_timer_cpu) 2835 cpu_is_offline(rdp->cpu) || rdp->cpu == tick_do_timer_cpu)
2846 return; 2836 return;
2847 if (rcu_gp_in_progress(rdp->rsp)) 2837 if (rcu_gp_in_progress(rdp->rsp))
@@ -2867,7 +2857,7 @@ static void rcu_sysidle_check_cpu(struct rcu_data *rdp, bool *isidle,
2867 */ 2857 */
2868static bool is_sysidle_rcu_state(struct rcu_state *rsp) 2858static bool is_sysidle_rcu_state(struct rcu_state *rsp)
2869{ 2859{
2870 return rsp == rcu_sysidle_state; 2860 return rsp == rcu_state_p;
2871} 2861}
2872 2862
2873/* 2863/*
@@ -2945,7 +2935,7 @@ static void rcu_sysidle_cancel(void)
2945static void rcu_sysidle_report(struct rcu_state *rsp, int isidle, 2935static void rcu_sysidle_report(struct rcu_state *rsp, int isidle,
2946 unsigned long maxj, bool gpkt) 2936 unsigned long maxj, bool gpkt)
2947{ 2937{
2948 if (rsp != rcu_sysidle_state) 2938 if (rsp != rcu_state_p)
2949 return; /* Wrong flavor, ignore. */ 2939 return; /* Wrong flavor, ignore. */
2950 if (gpkt && nr_cpu_ids <= CONFIG_NO_HZ_FULL_SYSIDLE_SMALL) 2940 if (gpkt && nr_cpu_ids <= CONFIG_NO_HZ_FULL_SYSIDLE_SMALL)
2951 return; /* Running state machine from timekeeping CPU. */ 2941 return; /* Running state machine from timekeeping CPU. */
@@ -3014,13 +3004,12 @@ bool rcu_sys_is_idle(void)
3014 3004
3015 /* Scan all the CPUs looking for nonidle CPUs. */ 3005 /* Scan all the CPUs looking for nonidle CPUs. */
3016 for_each_possible_cpu(cpu) { 3006 for_each_possible_cpu(cpu) {
3017 rdp = per_cpu_ptr(rcu_sysidle_state->rda, cpu); 3007 rdp = per_cpu_ptr(rcu_state_p->rda, cpu);
3018 rcu_sysidle_check_cpu(rdp, &isidle, &maxj); 3008 rcu_sysidle_check_cpu(rdp, &isidle, &maxj);
3019 if (!isidle) 3009 if (!isidle)
3020 break; 3010 break;
3021 } 3011 }
3022 rcu_sysidle_report(rcu_sysidle_state, 3012 rcu_sysidle_report(rcu_state_p, isidle, maxj, false);
3023 isidle, maxj, false);
3024 oldrss = rss; 3013 oldrss = rss;
3025 rss = ACCESS_ONCE(full_sysidle_state); 3014 rss = ACCESS_ONCE(full_sysidle_state);
3026 } 3015 }
@@ -3047,7 +3036,7 @@ bool rcu_sys_is_idle(void)
3047 * provided by the memory allocator. 3036 * provided by the memory allocator.
3048 */ 3037 */
3049 if (nr_cpu_ids > CONFIG_NO_HZ_FULL_SYSIDLE_SMALL && 3038 if (nr_cpu_ids > CONFIG_NO_HZ_FULL_SYSIDLE_SMALL &&
3050 !rcu_gp_in_progress(rcu_sysidle_state) && 3039 !rcu_gp_in_progress(rcu_state_p) &&
3051 !rsh.inuse && xchg(&rsh.inuse, 1) == 0) 3040 !rsh.inuse && xchg(&rsh.inuse, 1) == 0)
3052 call_rcu(&rsh.rh, rcu_sysidle_cb); 3041 call_rcu(&rsh.rh, rcu_sysidle_cb);
3053 return false; 3042 return false;