From: Paul Mackerras <paulus@samba.org>
To: vatsa@in.ibm.com
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 1/2] tickless idle cpus: core patch - v2
Date: Fri, 21 Apr 2006 20:49:48 +1000 [thread overview]
Message-ID: <17480.47308.126194.26202@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <20060410121847.GB5564@in.ibm.com>
Srivatsa Vaddagiri writes:
> This is the v2 of the core patch to skip ticks when a CPU is idle.
...
> +/* Returns 1 if this CPU was set in the mask */
> +static inline int clear_hzless_mask(void)
> +{
> + int cpu = smp_processor_id();
> + int rc = 0;
> +
> + if (unlikely(cpu_isset(cpu, nohz_cpu_mask))) {
> + cpu_clear(cpu, nohz_cpu_mask);
Is the nohz_cpu_mask accessed by other cpus? I wonder if using a
1-byte per-cpu variable for this, or even a bit in the thread_info
struct, might be better because it would reduce the number of atomic
bit set/clear operations we have to do.
> +#define MAX_DEC_COUNT UINT_MAX /* Decrementer is 32-bit */
The decrementer value should be restricted to INT_MAX. I think some
implementations will take a decrementer interrupt if you set the
decrementer to a negative value.
> +static void account_ticks(struct pt_regs *regs)
> +{
> + int next_dec;
> + int cpu = smp_processor_id();
> + unsigned long ticks;
> +
> while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu)))
> >= tb_ticks_per_jiffy) {
> /* Update last_jiffy */
This is just the loop body from timer_interrupt, right? Why do we
have to loop around N times after we skipped N ticks? What we're
doing inside the loop is:
- account_process_time, but we know we were in the idle task, so the
time is just idle time. If we have the accurate accounting stuff
turned on the first call to account_process_time will account all
the idle time anyway.
- we're not skipping ticks on the boot cpu (yet), so we won't do the
do_timer and timer_recalc_offset calls.
I think we could probably rearrange this code to eliminate the need
for the regs argument - all it's used for is telling whether we were
in user mode, and we know we weren't since we were in the idle task.
That would mean that we maybe could call start_hz_timer from the idle
task body instead of inside do_IRQ etc. The only thing we'd have to
watch out for is updating the decrementer if some interrupt handler
called add_timer/mod_timer etc.
Assuming we make the changes we have discussed to reduce the skewing
of the decrementer interrupts quite small, and allow any cpu to call
do_timer, then how where you thinking that xtime and the NTP stuff
would get updated, in the situation where all cpus are skipping ticks?
By doing N calls to do_timer in a row? Or by adding N-1 to jiffies_64
and then calling do_timer once?
> +#ifdef CONFIG_NO_IDLE_HZ
> + max_skip = __USE_RTC() ? HZ : MAX_DEC_COUNT / tb_ticks_per_jiffy;
> +#endif
If we allow the boot cpu to skip ticks, then we will have to make sure
that at least one cpu wakes up in time to do the updating in
recalc_timer_offset.
Paul.
next prev parent reply other threads:[~2006-04-21 10:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 6:30 [PATCH 1/4] tickless idle cpu - Allow any CPU to update jiffies Srivatsa Vaddagiri
2006-04-07 23:04 ` Paul Mackerras
2006-04-10 11:49 ` Srivatsa Vaddagiri
2006-04-10 12:18 ` [PATCH 1/2] tickless idle cpus: core patch - v2 Srivatsa Vaddagiri
2006-04-11 17:35 ` Paul Mackerras
2006-04-12 4:50 ` Srivatsa Vaddagiri
2006-04-21 10:49 ` Paul Mackerras [this message]
2006-04-24 15:39 ` Srivatsa Vaddagiri
2006-04-10 12:19 ` [PATCH 2/2] tickless idle cpus: allow boot cpu to skip ticks Srivatsa Vaddagiri
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=17480.47308.126194.26202@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=vatsa@in.ibm.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;
as well as URLs for NNTP newsgroup(s).