From: Andi Kleen <ak@suse.de>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [patch 1/2] sLeAZY FPU feature - x86_64 support
Date: Sat, 1 Jul 2006 23:49:36 +0200 [thread overview]
Message-ID: <200607012349.36091.ak@suse.de> (raw)
In-Reply-To: <1151773956.3195.47.camel@laptopd505.fenrus.org>
> After 256 switches, this is reset and lazy behavior is returned (until
> there are 5 consecutive ones again). The reason for this is to give apps
> that do longer bursts of FPU use still the lazy behavior back after some
> time.
Cool. This has been on my todo list forever.
However I'm not sure 256 is a good number. It seems a bit too high.
> Index: linux-2.6.17-sleazyfpu/arch/x86_64/kernel/process.c
> ===================================================================
> --- linux-2.6.17-sleazyfpu.orig/arch/x86_64/kernel/process.c
> +++ linux-2.6.17-sleazyfpu/arch/x86_64/kernel/process.c
> @@ -515,6 +515,10 @@ __switch_to(struct task_struct *prev_p,
> int cpu = smp_processor_id();
> struct tss_struct *tss = &per_cpu(init_tss, cpu);
>
> + /* we're going to use this soon, after a few expensive things */
> + if (next_p->fpu_counter>5)
> + prefetch(&next->i387.fxsave);
Did you measure this prefetch makes a difference? I would expect it to
be too soon to be really worth while (normally you need hundreds of
instructions for them to make sense and that's probably not the case here)
> #endif
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
Putting it at the end is also not good because there are the rarely used
cachelines. Probably better in the thread structure
-Andi
next prev parent reply other threads:[~2006-07-01 21:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-01 17:11 [patch 0/2] sLeAZY FPU feature Arjan van de Ven
2006-07-01 17:12 ` [patch 1/2] sLeAZY FPU feature - x86_64 support Arjan van de Ven
2006-07-01 21:49 ` Andi Kleen [this message]
2006-07-01 21:56 ` Arjan van de Ven
2006-07-01 17:13 ` [patch 2/2] sLeAZY FPU feature - i386 support Arjan van de Ven
2006-07-01 17:40 ` [patch 0/2] sLeAZY FPU feature Nick Piggin
2006-07-01 19:42 ` Arjan van de Ven
-- strict thread matches above, loose matches on Subject: below --
2006-07-02 1:39 [patch 1/2] sLeAZY FPU feature - x86_64 support Voluspa
2006-07-02 7:39 ` Arjan van de Ven
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=200607012349.36091.ak@suse.de \
--to=ak@suse.de \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.