[lkml]   [2012]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/2] i387: support lazy restore of FPU state

* Linus Torvalds <> 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.



 \ /
  Last update: 2012-02-20 08:53    [W:0.049 / U:13.932 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site