[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120220075101.GB30810@elte.hu>
Date: Mon, 20 Feb 2012 08:51:01 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] i387: support lazy restore of FPU state
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> +DECLARE_PER_CPU(struct task_struct *, fpu_owner_task);
> +static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
> +{
> + return new == percpu_read_stable(fpu_owner_task) &&
> + cpu == new->thread.fpu.last_cpu;
> +}
I guess the CPU hotplug case deserves a comment in the code: CPU
hotplug + replug of the same (but meanwhile reset) CPU is safe
because fpu_owner_task[cpu] gets reset to NULL.
Likewise, if we hot-unplug two CPUs and then insert the second
one, it's the same CPU index but not the same FPU state anymore.
There too the CPU hotplug code resetting fpu_owner_task to NULL
makes this optimization safe.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists