From: Arjan van de Ven <arjan@infradead.org>
To: Jesper Juhl <jj@chaosbits.net>
Cc: Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [GIT PULL] x86/fpu for v2.6.32
Date: Sat, 12 Sep 2009 05:47:47 +0200 [thread overview]
Message-ID: <20090912054747.730d4abe@infradead.org> (raw)
In-Reply-To: <alpine.LNX.2.00.0909112318190.31018@swampdragon.chaosbits.net>
On Fri, 11 Sep 2009 23:30:42 +0200 (CEST)
Jesper Juhl <jj@chaosbits.net> wrote:
>
> Hi Ingo,
>
> First of all, I want to say that I have no real objections to the
> patch what-so-ever. The following is merely to satisfy my own
> personal curiosity - and I'm sure you have better things to do than
> satisfy my curiosity, so if you want to ignore me; feel free :-)
>
> On Fri, 11 Sep 2009, Ingo Molnar wrote:
>
> [...]
> > + bool preload_fpu;
> >
> > /* never put a printk in __switch_to... printk() calls
> > wake_up*() indirectly */
> > - __unlazy_fpu(prev_p);
> > + /*
> > + * If the task has used fpu the last 5 timeslices, just do
> > a full
> > + * restore of the math state immediately to avoid the
> > trap; the
> > + * chances of needing FPU soon are obviously high now
> > + */
> > + preload_fpu = tsk_used_math(next_p) && next_p->fpu_counter
> > > 5;
> > + __unlazy_fpu(prev_p);
> >
> [...]
> > + * If the task has used fpu the last 5 timeslices, just do
> > a full
> > + * restore of the math state immediately to avoid the
> > trap; the
> > + * chances of needing FPU soon are obviously high now
> > + */
> > + preload_fpu = tsk_used_math(next_p) && next_p->fpu_counter
> > > 5;
>
> I'm wondering about two things:
>
(btw this is not new code)
> 1) Where did that magic constant "5" come from?
from me running a bunch of experiments noticing that tasks that do 5
do on average many more. Could it be 4? Perhaps.
> Is there some fundamental thing about CPU's, cache layout,
> scheduling, benchmarks or something else that I just don't know that
> makes 5 the magic "right number"? Why not 2, 3, 9 or 42?
At some point *a* number must be taken. That is currently 5.
Show us that any other number is better and we'll switch ;-)
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2009-09-12 3:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 19:44 [GIT PULL] x86/fpu for v2.6.32 Ingo Molnar
2009-09-11 21:30 ` Jesper Juhl
2009-09-12 3:47 ` Arjan van de Ven [this message]
2009-09-12 21:53 ` Jesper Juhl
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=20090912054747.730d4abe@infradead.org \
--to=arjan@infradead.org \
--cc=hpa@zytor.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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