Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[patch 0/2] nohz tweaking

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  Accepted libjgraphx-java 1.0.2.4-1 (source all)  
Author Message
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 1) Posted: Tue Sep 29, 2009 9:20 am
Post subject: [patch 0/2] nohz tweaking
Archived from groups: linux>kernel (more info?)

Greetings,
the two remainting patches of the nohz performance work I've been
doing. Both have been sent to the mailing lists before. Ingo had
a comment about patch #1, but no one but me seems to be interested
in patch #2. Neverless I would like to get both patches upstream.
I can create a branch for them on git390 but I feel that they should
go the path all the other nohz/time/clocksource patches went.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 2) Posted: Tue Sep 29, 2009 9:20 am
Post subject: [patch 2/2] [PATCH] nohz: introduce arch_needs_cpu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

From: Martin Schwidefsky <schwidefsky.DeleteThis@de.ibm.com>

Allow the architecture to request a normal jiffy tick when the system
goes idle and tick_nohz_stop_sched_tick is called . On s390 the hook is
used to prevent the system going fully idle if there has been an
interrupt other than a clock comparator interrupt since the last wakeup.

On s390 the HiperSockets response time for 1 connection ping-pong goes
down from 42 to 34 microseconds. The CPU cost decreases by 27%.

Signed-off-by: Martin Schwidefsky <schwidefsky.DeleteThis@de.ibm.com>
---

arch/s390/include/asm/cputime.h | 8 ++++++++
arch/s390/kernel/s390_ext.c | 2 ++
arch/s390/kernel/vtime.c | 2 ++
drivers/s390/cio/cio.c | 1 +
include/linux/tick.h | 3 +++
kernel/time/tick-sched.c | 13 ++++++++-----
6 files changed, 24 insertions(+), 5 deletions(-)

Index: quilt-2.6/arch/s390/include/asm/cputime.h
===================================================================
--- quilt-2.6.orig/arch/s390/include/asm/cputime.h 2009-09-24 09:06:44.000000000 +0200
+++ quilt-2.6/arch/s390/include/asm/cputime.h 2009-09-29 14:15:49.000000000 +0200
@@ -183,6 +183,7 @@
unsigned long long idle_count;
unsigned long long idle_enter;
unsigned long long idle_time;
+ int nohz_delay;
};

DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
@@ -198,4 +199,11 @@
vtime_start_cpu();
}

+static inline int s390_nohz_delay(int cpu)
+{
+ return per_cpu(s390_idle, cpu).nohz_delay != 0;
+}
+
+#define arch_needs_cpu(cpu) s390_nohz_delay(cpu)
+
#endif /* _S390_CPUTIME_H */
Index: quilt-2.6/arch/s390/kernel/s390_ext.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/s390_ext.c 2009-08-14 13:17:23.000000000 +0200
+++ quilt-2.6/arch/s390/kernel/s390_ext.c 2009-09-29 14:15:49.000000000 +0200
@@ -126,6 +126,8 @@
/* Serve timer interrupts first. */
clock_comparator_work();
kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
+ if (code != 0x1004)
+ __get_cpu_var(s390_idle).nohz_delay = 1;
index = ext_hash(code);
for (p = ext_int_hash[index]; p; p = p->next) {
if (likely(p->code == code))
Index: quilt-2.6/arch/s390/kernel/vtime.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/vtime.c 2009-08-14 13:17:23.000000000 +0200
+++ quilt-2.6/arch/s390/kernel/vtime.c 2009-09-29 14:15:49.000000000 +0200
@@ -167,6 +167,8 @@
/* Wait for external, I/O or machine check interrupt. */
psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT;

+ idle->nohz_delay = 0;
+
/* Check if the CPU timer needs to be reprogrammed. */
if (vq->do_spt) {
__u64 vmax = VTIMER_MAX_SLICE;
Index: quilt-2.6/drivers/s390/cio/cio.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/cio.c 2009-09-12 09:47:15.000000000 +0200
+++ quilt-2.6/drivers/s390/cio/cio.c 2009-09-29 14:15:49.000000000 +0200
@@ -618,6 +618,7 @@
old_regs = set_irq_regs(regs);
s390_idle_check();
irq_enter();
+ __get_cpu_var(s390_idle).nohz_delay = 1;
if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)
/* Serve timer interrupts first. */
clock_comparator_work();
Index: quilt-2.6/include/linux/tick.h
===================================================================
--- quilt-2.6.orig/include/linux/tick.h 2009-08-07 11:09:40.000000000 +0200
+++ quilt-2.6/include/linux/tick.h 2009-09-29 14:15:49.000000000 +0200
@@ -98,6 +98,9 @@
extern struct tick_sched *tick_get_tick_sched(int cpu);
extern void tick_check_idle(int cpu);
extern int tick_oneshot_mode_active(void);
+# ifndef arch_needs_cpu
+# define arch_needs_cpu(cpu) (0)
+# endif
# else
static inline void tick_clock_notify(void) { }
static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
Index: quilt-2.6/kernel/time/tick-sched.c
===================================================================
--- quilt-2.6.orig/kernel/time/tick-sched.c 2009-09-29 14:15:43.000000000 +0200
+++ quilt-2.6/kernel/time/tick-sched.c 2009-09-29 14:15:49.000000000 +0200
@@ -264,12 +264,15 @@
last_jiffies = jiffies;
} while (read_seqretry(&xtime_lock, seq));

- /* Get the next timer wheel timer */
- next_jiffies = get_next_timer_interrupt(last_jiffies);
- delta_jiffies = next_jiffies - last_jiffies;
-
- if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu))
+ if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
+ arch_needs_cpu(cpu)) {
+ next_jiffies = last_jiffies + 1;
delta_jiffies = 1;
+ } else {
+ /* Get the next timer wheel timer */
+ next_jiffies = get_next_timer_interrupt(last_jiffies);
+ delta_jiffies = next_jiffies - last_jiffies;
+ }
/*
* Do not stop the tick, if we are only one off
* or if the cpu is required for rcu

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 3) Posted: Tue Sep 29, 2009 9:20 am
Post subject: [patch 1/2] [PATCH] nohz: reuse ktime in sub-functions of tick_check_idle. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

From: Martin Schwidefsky <schwidefsky.RemoveThis@de.ibm.com>

On a system with NOHZ=y tick_check_idle calls tick_nohz_stop_idle and
tick_nohz_update_jiffies. Given the right conditions (ts->idle_active
and/or ts->tick_stopped) both function get a time stamp with ktime_get.
The same time stamp can be reused if both function require one.

On s390 this change has the additional benefit that gcc inlines the
tick_nohz_stop_idle function into tick_check_idle. The number of
instructions to execute tick_check_idle drops from 225 to 144
(without the ktime_get optimization it is 367 vs 215 instructions).

before:

0) | tick_check_idle() {
0) | tick_nohz_stop_idle() {
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.601 us | }
0) 1.765 us | }
0) 3.047 us | }
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.570 us | }
0) 1.727 us | }
0) | tick_do_update_jiffies64() {
0) 0.609 us | }
0) 8.055 us | }

after:

0) | tick_check_idle() {
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.617 us | }
0) 1.773 us | }
0) | tick_do_update_jiffies64() {
0) 0.593 us | }
0) 4.477 us | }

Cc: Ingo Molnar <mingo.RemoveThis@elte.hu>
Cc: Thomas Gleixner <tglx.RemoveThis@linutronix.de>
Cc: john stultz <johnstul.RemoveThis@us.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky.RemoveThis@de.ibm.com>
---

kernel/time/tick-sched.c | 62 +++++++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 29 deletions(-)

Index: quilt-2.6/kernel/time/tick-sched.c
===================================================================
--- quilt-2.6.orig/kernel/time/tick-sched.c 2009-08-07 11:09:40.000000000 +0200
+++ quilt-2.6/kernel/time/tick-sched.c 2009-09-29 14:15:43.000000000 +0200
@@ -134,18 +134,13 @@
* value. We do this unconditionally on any cpu, as we don't know whether the
* cpu, which has the update task assigned is in a long sleep.
*/
-static void tick_nohz_update_jiffies(void)
+static void tick_nohz_update_jiffies(ktime_t now)
{
int cpu = smp_processor_id();
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
unsigned long flags;
- ktime_t now;
-
- if (!ts->tick_stopped)
- return;

cpumask_clear_cpu(cpu, nohz_cpu_mask);
- now = ktime_get();
ts->idle_waketime = now;

local_irq_save(flags);
@@ -155,20 +150,17 @@
touch_softlockup_watchdog();
}

-static void tick_nohz_stop_idle(int cpu)
+static void tick_nohz_stop_idle(int cpu, ktime_t now)
{
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+ ktime_t delta;

- if (ts->idle_active) {
- ktime_t now, delta;
- now = ktime_get();
- delta = ktime_sub(now, ts->idle_entrytime);
- ts->idle_lastupdate = now;
- ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
- ts->idle_active = 0;
+ delta = ktime_sub(now, ts->idle_entrytime);
+ ts->idle_lastupdate = now;
+ ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
+ ts->idle_active = 0;

- sched_clock_idle_wakeup_event(0);
- }
+ sched_clock_idle_wakeup_event(0);
}

static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
@@ -431,7 +423,11 @@
ktime_t now;

local_irq_disable();
- tick_nohz_stop_idle(cpu);
+ if (ts->idle_active || (ts->inidle && ts->tick_stopped))
+ now = ktime_get();
+
+ if (ts->idle_active)
+ tick_nohz_stop_idle(cpu, now);

if (!ts->inidle || !ts->tick_stopped) {
ts->inidle = 0;
@@ -445,7 +441,6 @@

/* Update jiffies first */
select_nohz_load_balancer(0);
- now = ktime_get();
tick_do_update_jiffies64(now);
cpumask_clear_cpu(cpu, nohz_cpu_mask);

@@ -579,22 +574,18 @@
* timer and do not touch the other magic bits which need to be done
* when idle is left.
*/
-static void tick_nohz_kick_tick(int cpu)
+static void tick_nohz_kick_tick(int cpu, ktime_t now)
{
#if 0
/* Switch back to 2.6.27 behaviour */

struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
- ktime_t delta, now;
-
- if (!ts->tick_stopped)
- return;
+ ktime_t delta;

/*
* Do not touch the tick device, when the next expiry is either
* already reached or less/equal than the tick period.
*/
- now = ktime_get();
delta = ktime_sub(hrtimer_get_expires(&ts->sched_timer), now);
if (delta.tv64 <= tick_period.tv64)
return;
@@ -603,9 +594,26 @@
#endif
}

+static inline void tick_check_nohz(int cpu)
+{
+ struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+ ktime_t now;
+
+ if (!ts->idle_active && !ts->tick_stopped)
+ return;
+ now = ktime_get();
+ if (ts->idle_active)
+ tick_nohz_stop_idle(cpu, now);
+ if (ts->tick_stopped) {
+ tick_nohz_update_jiffies(now);
+ tick_nohz_kick_tick(cpu, now);
+ }
+}
+
#else

static inline void tick_nohz_switch_to_nohz(void) { }
+static inline void tick_check_nohz(int cpu) { }

#endif /* NO_HZ */

@@ -615,11 +623,7 @@
void tick_check_idle(int cpu)
{
tick_check_oneshot_broadcast(cpu);
-#ifdef CONFIG_NO_HZ
- tick_nohz_stop_idle(cpu);
- tick_nohz_update_jiffies();
- tick_nohz_kick_tick(cpu);
-#endif
+ tick_check_nohz(cpu);
}

/*

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Thomas Gleixner

External


Since: Nov 10, 2006
Posts: 711



(Msg. 4) Posted: Wed Sep 30, 2009 5:20 am
Post subject: Re: [patch 0/2] nohz tweaking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Martin,

On Tue, 29 Sep 2009, Martin Schwidefsky wrote:

> Greetings,
> the two remainting patches of the nohz performance work I've been
> doing. Both have been sent to the mailing lists before. Ingo had
> a comment about patch #1, but no one but me seems to be interested
> in patch #2. Neverless I would like to get both patches upstream.
> I can create a branch for them on git390 but I feel that they should
> go the path all the other nohz/time/clocksource patches went.

Sorry, that's my fault. I forgot them over the watchdog
wreckage. Picking them up now.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 5) Posted: Wed Sep 30, 2009 7:20 am
Post subject: Re: [patch 0/2] nohz tweaking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 30 Sep 2009 12:06:42 +0200 (CEST)
Thomas Gleixner <tglx.RemoveThis@linutronix.de> wrote:

> Martin,
>
> On Tue, 29 Sep 2009, Martin Schwidefsky wrote:
>
> > Greetings,
> > the two remainting patches of the nohz performance work I've been
> > doing. Both have been sent to the mailing lists before. Ingo had
> > a comment about patch #1, but no one but me seems to be interested
> > in patch #2. Neverless I would like to get both patches upstream.
> > I can create a branch for them on git390 but I feel that they should
> > go the path all the other nohz/time/clocksource patches went.
>
> Sorry, that's my fault. I forgot them over the watchdog
> wreckage. Picking them up now.

Thats great, thanks. And yes the clocksource/watchdog problems have
been painful..

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 6) Posted: Wed Nov 04, 2009 9:20 am
Post subject: Re: [patch 0/2] nohz tweaking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Moin Thomas,

On Wed, 30 Sep 2009 12:06:42 +0200 (CEST)
Thomas Gleixner <tglx DeleteThis @linutronix.de> wrote:

> Martin,
>
> On Tue, 29 Sep 2009, Martin Schwidefsky wrote:
>
> > Greetings,
> > the two remainting patches of the nohz performance work I've been
> > doing. Both have been sent to the mailing lists before. Ingo had
> > a comment about patch #1, but no one but me seems to be interested
> > in patch #2. Neverless I would like to get both patches upstream.
> > I can create a branch for them on git390 but I feel that they should
> > go the path all the other nohz/time/clocksource patches went.
>
> Sorry, that's my fault. I forgot them over the watchdog
> wreckage. Picking them up now.

I could not find the patches on tip timers/core. Where did you put them ?

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
tip-bot for Martin Schwid

External


Since: Aug 15, 2009
Posts: 15



(Msg. 7) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [tip:timers/core] nohz: Reuse ktime in sub-functions of tick_check_idle. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Commit-ID: eed3b9cf3fe3fcc7a50238dfcab63a63914e8f42
Gitweb: http://git.kernel.org/tip/eed3b9cf3fe3fcc7a50238dfcab63a63914e8f42
Author: Martin Schwidefsky <schwidefsky.TakeThisOut@de.ibm.com>
AuthorDate: Tue, 29 Sep 2009 14:25:15 +0200
Committer: Thomas Gleixner <tglx.TakeThisOut@linutronix.de>
CommitDate: Thu, 5 Nov 2009 07:53:53 +0100

nohz: Reuse ktime in sub-functions of tick_check_idle.

On a system with NOHZ=y tick_check_idle calls tick_nohz_stop_idle and
tick_nohz_update_jiffies. Given the right conditions (ts->idle_active
and/or ts->tick_stopped) both function get a time stamp with ktime_get.
The same time stamp can be reused if both function require one.

On s390 this change has the additional benefit that gcc inlines the
tick_nohz_stop_idle function into tick_check_idle. The number of
instructions to execute tick_check_idle drops from 225 to 144
(without the ktime_get optimization it is 367 vs 215 instructions).

before:

0) | tick_check_idle() {
0) | tick_nohz_stop_idle() {
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.601 us | }
0) 1.765 us | }
0) 3.047 us | }
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.570 us | }
0) 1.727 us | }
0) | tick_do_update_jiffies64() {
0) 0.609 us | }
0) 8.055 us | }

after:

0) | tick_check_idle() {
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.617 us | }
0) 1.773 us | }
0) | tick_do_update_jiffies64() {
0) 0.593 us | }
0) 4.477 us | }

Signed-off-by: Martin Schwidefsky <schwidefsky.TakeThisOut@de.ibm.com>
Cc: john stultz <johnstul.TakeThisOut@us.ibm.com>
LKML-Reference: <20090929122533.206589318.TakeThisOut@de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx.TakeThisOut@linutronix.de>
---
kernel/time/tick-sched.c | 62 ++++++++++++++++++++++++---------------------
1 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index e0f59a2..7378e2c 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -134,18 +134,13 @@ __setup("nohz=", setup_tick_nohz);
* value. We do this unconditionally on any cpu, as we don't know whether the
* cpu, which has the update task assigned is in a long sleep.
*/
-static void tick_nohz_update_jiffies(void)
+static void tick_nohz_update_jiffies(ktime_t now)
{
int cpu = smp_processor_id();
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
unsigned long flags;
- ktime_t now;
-
- if (!ts->tick_stopped)
- return;

cpumask_clear_cpu(cpu, nohz_cpu_mask);
- now = ktime_get();
ts->idle_waketime = now;

local_irq_save(flags);
@@ -155,20 +150,17 @@ static void tick_nohz_update_jiffies(void)
touch_softlockup_watchdog();
}

-static void tick_nohz_stop_idle(int cpu)
+static void tick_nohz_stop_idle(int cpu, ktime_t now)
{
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+ ktime_t delta;

- if (ts->idle_active) {
- ktime_t now, delta;
- now = ktime_get();
- delta = ktime_sub(now, ts->idle_entrytime);
- ts->idle_lastupdate = now;
- ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
- ts->idle_active = 0;
+ delta = ktime_sub(now, ts->idle_entrytime);
+ ts->idle_lastupdate = now;
+ ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
+ ts->idle_active = 0;

- sched_clock_idle_wakeup_event(0);
- }
+ sched_clock_idle_wakeup_event(0);
}

static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
@@ -431,7 +423,11 @@ void tick_nohz_restart_sched_tick(void)
ktime_t now;

local_irq_disable();
- tick_nohz_stop_idle(cpu);
+ if (ts->idle_active || (ts->inidle && ts->tick_stopped))
+ now = ktime_get();
+
+ if (ts->idle_active)
+ tick_nohz_stop_idle(cpu, now);

if (!ts->inidle || !ts->tick_stopped) {
ts->inidle = 0;
@@ -445,7 +441,6 @@ void tick_nohz_restart_sched_tick(void)

/* Update jiffies first */
select_nohz_load_balancer(0);
- now = ktime_get();
tick_do_update_jiffies64(now);
cpumask_clear_cpu(cpu, nohz_cpu_mask);

@@ -579,22 +574,18 @@ static void tick_nohz_switch_to_nohz(void)
* timer and do not touch the other magic bits which need to be done
* when idle is left.
*/
-static void tick_nohz_kick_tick(int cpu)
+static void tick_nohz_kick_tick(int cpu, ktime_t now)
{
#if 0
/* Switch back to 2.6.27 behaviour */

struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
- ktime_t delta, now;
-
- if (!ts->tick_stopped)
- return;
+ ktime_t delta;

/*
* Do not touch the tick device, when the next expiry is either
* already reached or less/equal than the tick period.
*/
- now = ktime_get();
delta = ktime_sub(hrtimer_get_expires(&ts->sched_timer), now);
if (delta.tv64 <= tick_period.tv64)
return;
@@ -603,9 +594,26 @@ static void tick_nohz_kick_tick(int cpu)
#endif
}

+static inline void tick_check_nohz(int cpu)
+{
+ struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+ ktime_t now;
+
+ if (!ts->idle_active && !ts->tick_stopped)
+ return;
+ now = ktime_get();
+ if (ts->idle_active)
+ tick_nohz_stop_idle(cpu, now);
+ if (ts->tick_stopped) {
+ tick_nohz_update_jiffies(now);
+ tick_nohz_kick_tick(cpu, now);
+ }
+}
+
#else

static inline void tick_nohz_switch_to_nohz(void) { }
+static inline void tick_check_nohz(int cpu) { }

#endif /* NO_HZ */

@@ -615,11 +623,7 @@ static inline void tick_nohz_switch_to_nohz(void) { }
void tick_check_idle(int cpu)
{
tick_check_oneshot_broadcast(cpu);
-#ifdef CONFIG_NO_HZ
- tick_nohz_stop_idle(cpu);
- tick_nohz_update_jiffies();
- tick_nohz_kick_tick(cpu);
-#endif
+ tick_check_nohz(cpu);
}

/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
tip-bot for Martin Schwid

External


Since: Aug 15, 2009
Posts: 15



(Msg. 8) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [tip:timers/core] nohz: Introduce arch_needs_cpu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Commit-ID: 3c5d92a0cfb5103c0d5ab74d4ae6373d3af38148
Gitweb: http://git.kernel.org/tip/3c5d92a0cfb5103c0d5ab74d4ae6373d3af38148
Author: Martin Schwidefsky <schwidefsky DeleteThis @de.ibm.com>
AuthorDate: Tue, 29 Sep 2009 14:25:16 +0200
Committer: Thomas Gleixner <tglx DeleteThis @linutronix.de>
CommitDate: Thu, 5 Nov 2009 07:53:53 +0100

nohz: Introduce arch_needs_cpu

Allow the architecture to request a normal jiffy tick when the system
goes idle and tick_nohz_stop_sched_tick is called . On s390 the hook is
used to prevent the system going fully idle if there has been an
interrupt other than a clock comparator interrupt since the last wakeup.

On s390 the HiperSockets response time for 1 connection ping-pong goes
down from 42 to 34 microseconds. The CPU cost decreases by 27%.

Signed-off-by: Martin Schwidefsky <schwidefsky DeleteThis @de.ibm.com>
LKML-Reference: <20090929122533.402715150 DeleteThis @de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx DeleteThis @linutronix.de>
---
arch/s390/include/asm/cputime.h | 8 ++++++++
arch/s390/kernel/s390_ext.c | 2 ++
arch/s390/kernel/vtime.c | 2 ++
drivers/s390/cio/cio.c | 1 +
include/linux/tick.h | 3 +++
kernel/time/tick-sched.c | 13 ++++++++-----
6 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 24b1244..95f3561 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -183,6 +183,7 @@ struct s390_idle_data {
unsigned long long idle_count;
unsigned long long idle_enter;
unsigned long long idle_time;
+ int nohz_delay;
};

DECLARE_PER_CPU(struct s390_idle_data, s390_idle);
@@ -198,4 +199,11 @@ static inline void s390_idle_check(void)
vtime_start_cpu();
}

+static inline int s390_nohz_delay(int cpu)
+{
+ return per_cpu(s390_idle, cpu).nohz_delay != 0;
+}
+
+#define arch_needs_cpu(cpu) s390_nohz_delay(cpu)
+
#endif /* _S390_CPUTIME_H */
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 0de305b..59618bc 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -126,6 +126,8 @@ void __irq_entry do_extint(struct pt_regs *regs, unsigned short code)
/* Serve timer interrupts first. */
clock_comparator_work();
kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
+ if (code != 0x1004)
+ __get_cpu_var(s390_idle).nohz_delay = 1;
index = ext_hash(code);
for (p = ext_int_hash[index]; p; p = p->next) {
if (likely(p->code == code))
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c41bb0d..b59a812 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -167,6 +167,8 @@ void vtime_stop_cpu(void)
/* Wait for external, I/O or machine check interrupt. */
psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT;

+ idle->nohz_delay = 0;
+
/* Check if the CPU timer needs to be reprogrammed. */
if (vq->do_spt) {
__u64 vmax = VTIMER_MAX_SLICE;
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 138124f..126f240 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -618,6 +618,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
old_regs = set_irq_regs(regs);
s390_idle_check();
irq_enter();
+ __get_cpu_var(s390_idle).nohz_delay = 1;
if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)
/* Serve timer interrupts first. */
clock_comparator_work();
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 0482229..8dc0821 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -98,6 +98,9 @@ extern int tick_check_oneshot_change(int allow_nohz);
extern struct tick_sched *tick_get_tick_sched(int cpu);
extern void tick_check_idle(int cpu);
extern int tick_oneshot_mode_active(void);
+# ifndef arch_needs_cpu
+# define arch_needs_cpu(cpu) (0)
+# endif
# else
static inline void tick_clock_notify(void) { }
static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 7378e2c..3840f6d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -264,12 +264,15 @@ void tick_nohz_stop_sched_tick(int inidle)
last_jiffies = jiffies;
} while (read_seqretry(&xtime_lock, seq));

- /* Get the next timer wheel timer */
- next_jiffies = get_next_timer_interrupt(last_jiffies);
- delta_jiffies = next_jiffies - last_jiffies;
-
- if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu))
+ if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
+ arch_needs_cpu(cpu)) {
+ next_jiffies = last_jiffies + 1;
delta_jiffies = 1;
+ } else {
+ /* Get the next timer wheel timer */
+ next_jiffies = get_next_timer_interrupt(last_jiffies);
+ delta_jiffies = next_jiffies - last_jiffies;
+ }
/*
* Do not stop the tick, if we are only one off
* or if the cpu is required for rcu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Ingo Molnar

External


Since: Nov 05, 2003
Posts: 2922



(Msg. 9) Posted: Fri Nov 06, 2009 3:20 am
Post subject: Re: [patch 0/2] nohz tweaking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

* Martin Schwidefsky <schwidefsky.TakeThisOut@de.ibm.com> wrote:

> Moin Thomas,
>
> On Wed, 30 Sep 2009 12:06:42 +0200 (CEST)
> Thomas Gleixner <tglx.TakeThisOut@linutronix.de> wrote:
>
> > Martin,
> >
> > On Tue, 29 Sep 2009, Martin Schwidefsky wrote:
> >
> > > Greetings,
> > > the two remainting patches of the nohz performance work I've been
> > > doing. Both have been sent to the mailing lists before. Ingo had
> > > a comment about patch #1, but no one but me seems to be interested
> > > in patch #2. Neverless I would like to get both patches upstream.
> > > I can create a branch for them on git390 but I feel that they should
> > > go the path all the other nohz/time/clocksource patches went.
> >
> > Sorry, that's my fault. I forgot them over the watchdog
> > wreckage. Picking them up now.
>
> I could not find the patches on tip timers/core. Where did you put them ?

these are the currently pending patches in tip:timers/core:

3c5d92a: nohz: Introduce arch_needs_cpu
eed3b9c: nohz: Reuse ktime in sub-functions of tick_check_idle.
7bc7d63: time: Remove xtime_cache
a092ff0: time: Implement logarithmic time accumulation

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Martin Schwidefsky

External


Since: Nov 06, 2006
Posts: 557



(Msg. 10) Posted: Fri Nov 06, 2009 5:20 am
Post subject: Re: [patch 0/2] nohz tweaking [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Ingo,

On Fri, 6 Nov 2009 09:41:38 +0100
Ingo Molnar <mingo.DeleteThis@elte.hu> wrote:

> * Martin Schwidefsky <schwidefsky.DeleteThis@de.ibm.com> wrote:
>
> > Moin Thomas,
> >
> > On Wed, 30 Sep 2009 12:06:42 +0200 (CEST)
> > Thomas Gleixner <tglx.DeleteThis@linutronix.de> wrote:
> >
> > > Martin,
> > >
> > > On Tue, 29 Sep 2009, Martin Schwidefsky wrote:
> > >
> > > > Greetings,
> > > > the two remainting patches of the nohz performance work I've been
> > > > doing. Both have been sent to the mailing lists before. Ingo had
> > > > a comment about patch #1, but no one but me seems to be interested
> > > > in patch #2. Neverless I would like to get both patches upstream.
> > > > I can create a branch for them on git390 but I feel that they should
> > > > go the path all the other nohz/time/clocksource patches went.
> > >
> > > Sorry, that's my fault. I forgot them over the watchdog
> > > wreckage. Picking them up now.
> >
> > I could not find the patches on tip timers/core. Where did you put them ?
>
> these are the currently pending patches in tip:timers/core:
>
> 3c5d92a: nohz: Introduce arch_needs_cpu
> eed3b9c: nohz: Reuse ktime in sub-functions of tick_check_idle.
> 7bc7d63: time: Remove xtime_cache
> a092ff0: time: Implement logarithmic time accumulation

Thanks for the list. Thomas added 3c5d92a and eed3b9c yesterday and
I am happy now. I have two more optimization patches for the clockevents
code, but I'm not don't quite content with them yet.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[RFC][PATCH 2/3] export time until next timer interrupt us.. - This patch exposes information about the time remaining until the next timer interrupt expires by utilizing the dyntick...

[PATCH 7/9] Fix nohz compile.patch - More goo from hrtimers integration. We do compile and run properly with NO_HZ enabled. There was a period when we..

NOHZ: local_softirq_pending 08 - Hi! A lot of "NOHZ: local_softirq_pending 08" messages (about 100) and then suddenly stoped to show. I have...

2.6.21-git4 Scheduler, NOHZ, VFS bugs - Hi, I ran this script tree times, #! /bin/sh for i in `find /sys/ -type f` do echo "wyświetlam $i" ...

tuning/tweaking VM settings for low memory (preventing OOM) - I'm working on an embedded PPC setup with 64M of memory and no swap. I'm trying to figure out how best to tune the V...

[PATCH] CELL PPU Oprofile cleanup patch (updated patch) - This is the second update to the patch previously posted by Maynard Johnson as "PATCH 1/4. Add support to OProfile...
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]