mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Venkatesh Pallipadi <venki@google.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Paul Menage <menage@google.com>,
	linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [RFC PATCH 2/4] x86: Add IRQ_TIME_ACCOUNTING, finer accounting of irq time to task
Date: Tue, 25 May 2010 08:35:11 +0200	[thread overview]
Message-ID: <1274769311.5882.96.camel@twins> (raw)
In-Reply-To: <1274746282-21533-3-git-send-email-venki@google.com>

On Mon, 2010-05-24 at 17:11 -0700, Venkatesh Pallipadi wrote:
> +void account_system_vtime(struct task_struct *tsk)
> +{
> +       unsigned long flags;
> +       int cpu;
> +       u64 now;
> +
> +       local_irq_save(flags);
> +       cpu = task_cpu(tsk);
> +       now = sched_clock_cpu(cpu);
> +       if (hardirq_count())
> +               tsk->hi_time += now - per_cpu(irq_start_time, cpu);
> +       else if (softirq_count())
> +               tsk->si_time += now - per_cpu(irq_start_time, cpu);
> +
> +       per_cpu(irq_start_time, cpu) = now;
> +       local_irq_restore(flags);
> +} 

Right, so this gets called from irq_enter/exit() and __do_softirq().

The reason I never pressed onwards with this (I had patches to add IRQ
time accounting) is that it sucks terribly for anything falling back to
jiffies -- maybe find some smart way to disable the whole call when
there's no TSC available, preferably without adding conditionals, using
alternatives maybe?

I guess you mostly side-stepped that by adding a IRQ_TIME_ACCOUNTING
config (but forgot to make it depend on X86_TSC).

Another thing I dislike about this account_system_vtime() is that its
the same call for both IRQ and SoftIRQ, leaving us to add conditionals
inside the call to figure out what context we got called from.

[ Adedd the s390 and ppc guys who already use this stuff ]

Anyway, once we have this, please also add it to sched_rt_avg_update()
(which should really be called sched_!fair_avg_update()).

Also, did you measure the overhead of doing this? sched_clock_cpu() adds
a cmpxchg64 on all systems that don't have a rock solid TSC (ie. most of
todays machines).

Another thing that would be real nice is if you could find a way to not
make all of this x86 specific.

  parent reply	other threads:[~2010-05-25  6:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25  0:11 [RFC PATCH 0/4] Finer granularity and task/cgroup irq time accounting Venkatesh Pallipadi
2010-05-25  0:11 ` [RFC PATCH 1/4] sched: Track and export per task [hard|soft]irq time Venkatesh Pallipadi
2010-05-25  0:11   ` [RFC PATCH 2/4] x86: Add IRQ_TIME_ACCOUNTING, finer accounting of irq time to task Venkatesh Pallipadi
2010-05-25  0:11     ` [RFC PATCH 3/4] sched: Generalize cpuacct usage tracking making it simpler to add new stats Venkatesh Pallipadi
2010-05-25  0:11       ` [RFC PATCH 4/4] sched: Export irq times through cpuacct cgroup Venkatesh Pallipadi
2010-05-25  6:35     ` Peter Zijlstra [this message]
2010-05-25 21:40       ` [RFC PATCH 2/4] x86: Add IRQ_TIME_ACCOUNTING, finer accounting of irq time to task Venkatesh Pallipadi
2010-05-26  6:54         ` Peter Zijlstra
2010-05-25  9:13   ` [RFC PATCH 1/4] sched: Track and export per task [hard|soft]irq time Balbir Singh
2010-05-25 21:45     ` Venkatesh Pallipadi
2010-05-25  7:00 ` [RFC PATCH 0/4] Finer granularity and task/cgroup irq time accounting Balbir Singh
2010-05-25  8:14 ` Peter Zijlstra
2010-05-25 17:05   ` Venkatesh Pallipadi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274769311.5882.96.camel@twins \
    --to=peterz@infradead.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=pjt@google.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=venki@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®