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

* Linus Torvalds <torvalds@linux-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


\
 
 \ /
  Last update: 2012-02-20 08:53    [W:0.086 / U:2.156 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site