[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAf4BNLmpMV7I_My@gmail.com>
Date: Tue, 22 Apr 2025 22:11:48 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Andy Lutomirski <luto@...capital.net>,
Dave Hansen <dave@...1.net>, Brian Gerst <brgerst@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>, "H . Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Chang S . Bae" <chang.seok.bae@...el.com>
Subject: Re: question about switch_fpu_prepare/switch_fpu_finish
* Oleg Nesterov <oleg@...hat.com> wrote:
> I must have missed something, but I can't understand this logic, it
> seems unnecessarily complicated today.
>
> 1. Now that switch_fpu_finish() doesn't load the FPU state, I think it
> can be folded into switch_fpu_prepare().
Agreed.
> 2. But the main question is that I fail to understand why
> __switch_to() -> switch_fpu_finish() uses the "next" task to set
> TIF_NEED_FPU_LOAD.
>
> I think that set_tsk_thread_flag(prev_p, TIF_NEED_FPU_LOAD) makes
> more sense.
>
> Just in case, note that fpu_clone() sets TIF_NEED_FPU_LOAD, so
> we should not worry about the 1st __switch_to(next_p).
>
> IOW, can you explain why the (untested) patch below could be wrong?
I think your patch should work.
> We can even remove the PF_KTHREAD check in switch_fpu_prepare(), kthreads
> should never clear TIF_NEED_FPU_LOAD...
Agreed.
Thanks,
Ingo
Powered by blists - more mailing lists