Re: [PATCH 21/27] nohz: Only stop the tick on RCU nocb CPUs

2013-01-04 Thread Frederic Weisbecker
2013/1/2 Namhyung Kim :
> You may want to add the following also to shut up the gcc:
>
>   CC  kernel/rcutree.o
> In file included from /home/namhyung/project/linux/kernel/rcutree.c:58:0:
> /home/namhyung/project/linux/kernel/rcutree.h:539:13: warning: 
> ‘is_nocb_cpu’ declared ‘static’ but never defined [-Wunused-function]
>
>
> Thanks,
> Namhyung
>
>
> diff --git a/kernel/rcutree.h b/kernel/rcutree.h
> index 4b69291b093d..fbbad931c36a 100644
> --- a/kernel/rcutree.h
> +++ b/kernel/rcutree.h
> @@ -536,7 +536,6 @@ static void print_cpu_stall_info(struct rcu_state *rsp, 
> int cpu);
>  static void print_cpu_stall_info_end(void);
>  static void zero_cpu_stall_ticks(struct rcu_data *rdp);
>  static void increment_cpu_stall_ticks(void);
> -static bool is_nocb_cpu(int cpu);
>  static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
> bool lazy);
>  static bool rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,

I'm folding that fix for the next version.

Thanks Namhyung!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 21/27] nohz: Only stop the tick on RCU nocb CPUs

2013-01-02 Thread Namhyung Kim
Hi Frederic,

On Sat, 29 Dec 2012 17:43:00 +0100, Frederic Weisbecker wrote:
> On a full dynticks CPU, we want the RCU callbacks to be
> offlined to another CPU, otherwise we need to keep
> the tick to wait for the grace period completion.
>
> Ensure the full dynticks CPU is also an rcu_nocb one.
[snip]
> -static bool is_nocb_cpu(int cpu)
> -{
> - return false;
> -}
> -

You may want to add the following also to shut up the gcc:

  CC  kernel/rcutree.o
In file included from /home/namhyung/project/linux/kernel/rcutree.c:58:0:
/home/namhyung/project/linux/kernel/rcutree.h:539:13: warning: 
‘is_nocb_cpu’ declared ‘static’ but never defined [-Wunused-function]


Thanks,
Namhyung


diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 4b69291b093d..fbbad931c36a 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -536,7 +536,6 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int 
cpu);
 static void print_cpu_stall_info_end(void);
 static void zero_cpu_stall_ticks(struct rcu_data *rdp);
 static void increment_cpu_stall_ticks(void);
-static bool is_nocb_cpu(int cpu);
 static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
bool lazy);
 static bool rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 21/27] nohz: Only stop the tick on RCU nocb CPUs

2012-12-29 Thread Frederic Weisbecker
On a full dynticks CPU, we want the RCU callbacks to be
offlined to another CPU, otherwise we need to keep
the tick to wait for the grace period completion.

Ensure the full dynticks CPU is also an rcu_nocb one.

Signed-off-by: Frederic Weisbecker 
Cc: Alessio Igor Bogani 
Cc: Andrew Morton 
Cc: Chris Metcalf 
Cc: Christoph Lameter 
Cc: Geoff Levand 
Cc: Gilad Ben Yossef 
Cc: Hakan Akkan 
Cc: Ingo Molnar 
Cc: Paul E. McKenney 
Cc: Paul Gortmaker 
Cc: Peter Zijlstra 
Cc: Steven Rostedt 
Cc: Thomas Gleixner 
---
 include/linux/rcupdate.h |7 +++
 kernel/rcutree.c |6 +++---
 kernel/rcutree_plugin.h  |   13 -
 kernel/time/tick-sched.c |   20 +---
 4 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 275aa3f..829312e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -992,4 +992,11 @@ static inline notrace void 
rcu_read_unlock_sched_notrace(void)
 #define kfree_rcu(ptr, rcu_head)   \
__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
 
+#ifdef CONFIG_RCU_NOCB_CPU
+bool rcu_is_nocb_cpu(int cpu);
+#else
+static inline bool rcu_is_nocb_cpu(int cpu) { return false; };
+#endif
+
+
 #endif /* __LINUX_RCUPDATE_H */
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 302d360..e9e0ffa 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1589,7 +1589,7 @@ rcu_send_cbs_to_orphanage(int cpu, struct rcu_state *rsp,
  struct rcu_node *rnp, struct rcu_data *rdp)
 {
/* No-CBs CPUs do not have orphanable callbacks. */
-   if (is_nocb_cpu(rdp->cpu))
+   if (rcu_is_nocb_cpu(rdp->cpu))
return;
 
/*
@@ -2651,10 +2651,10 @@ static void _rcu_barrier(struct rcu_state *rsp)
 * corresponding CPU's preceding callbacks have been invoked.
 */
for_each_possible_cpu(cpu) {
-   if (!cpu_online(cpu) && !is_nocb_cpu(cpu))
+   if (!cpu_online(cpu) && !rcu_is_nocb_cpu(cpu))
continue;
rdp = per_cpu_ptr(rsp->rda, cpu);
-   if (is_nocb_cpu(cpu)) {
+   if (rcu_is_nocb_cpu(cpu)) {
_rcu_barrier_trace(rsp, "OnlineNoCB", cpu,
   rsp->n_barrier_done);
atomic_inc(&rsp->barrier_cpu_count);
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index f6e5ec2..625b327 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -2160,7 +2160,7 @@ static int __init rcu_nocb_setup(char *str)
 __setup("rcu_nocbs=", rcu_nocb_setup);
 
 /* Is the specified CPU a no-CPUs CPU? */
-static bool is_nocb_cpu(int cpu)
+bool rcu_is_nocb_cpu(int cpu)
 {
if (have_rcu_nocb_mask)
return cpumask_test_cpu(cpu, rcu_nocb_mask);
@@ -2218,7 +2218,7 @@ static bool __call_rcu_nocb(struct rcu_data *rdp, struct 
rcu_head *rhp,
bool lazy)
 {
 
-   if (!is_nocb_cpu(rdp->cpu))
+   if (!rcu_is_nocb_cpu(rdp->cpu))
return 0;
__call_rcu_nocb_enqueue(rdp, rhp, &rhp->next, 1, lazy);
return 1;
@@ -2235,7 +2235,7 @@ static bool __maybe_unused 
rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
long qll = rsp->qlen_lazy;
 
/* If this is not a no-CBs CPU, tell the caller to do it the old way. */
-   if (!is_nocb_cpu(smp_processor_id()))
+   if (!rcu_is_nocb_cpu(smp_processor_id()))
return 0;
rsp->qlen = 0;
rsp->qlen_lazy = 0;
@@ -2275,7 +2275,7 @@ static bool nocb_cpu_expendable(int cpu)
 * If there are no no-CB CPUs or if this CPU is not a no-CB CPU,
 * then offlining this CPU is harmless.  Let it happen.
 */
-   if (!have_rcu_nocb_mask || is_nocb_cpu(cpu))
+   if (!have_rcu_nocb_mask || rcu_is_nocb_cpu(cpu))
return 1;
 
/* If no memory, play it safe and keep the CPU around. */
@@ -2456,11 +2456,6 @@ static void __init rcu_init_nocb(void)
 
 #else /* #ifdef CONFIG_RCU_NOCB_CPU */
 
-static bool is_nocb_cpu(int cpu)
-{
-   return false;
-}
-
 static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
bool lazy)
 {
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 9d31b08..78e5341 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -587,6 +587,19 @@ void tick_nohz_idle_enter(void)
local_irq_enable();
 }
 
+#ifdef CONFIG_NO_HZ_FULL
+static bool can_stop_full_tick(int cpu)
+{
+   if (!sched_can_stop_tick())
+   return false;
+
+   if (!rcu_is_nocb_cpu(cpu))
+   return false;
+
+   return true;
+}
+#endif
+
 static void tick_nohz_full_stop_tick(struct tick_sched *ts)
 {
 #ifdef CONFIG_NO_HZ_FULL
@@ -598,7 +611,7 @@ static void tick_nohz_full_stop_tick(struct tick_sched *ts)
if (!ts->tick_st