[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAf3fUmft1NTksFY@gmail.com>
Date: Tue, 22 Apr 2025 22:09:33 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: 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>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Chang S . Bae" <chang.seok.bae@...el.com>
Subject: Re: [PATCH -v5 0/8] sched: Make task_struct::thread constant size,
x86/fpu: Remove thread::fpu
* Oleg Nesterov <oleg@...hat.com> wrote:
> Ingo, sorry for delay.
>
> So just in case, the whole series looks good to me. I am going to send a
> couple of minor cleanups on top of it,
Great, please do!
> [...] but let me ask first if I missed something or not.
You probably didn't. :-)
> - x86_init_fpu is not really used after 4/8, it can be killed
Indeed!
>
> - DEFINE_EVENT(x86_fpu, x86_fpu_copy_src) can be killed after 7/8
Agreed.
> - arch_dup_task_struct() still does
>
> /* init_task is not dynamically sized (incomplete FPU state) */
> if (unlikely(src == &init_task))
> memcpy_and_pad(dst, arch_task_struct_size, src, sizeof(init_task), 0);
> else
> memcpy(dst, src, arch_task_struct_size);
>
> and I don't understand why do we need to check src == &init_task. It seems
> that we can always do
>
> memcpy_and_pad(dst, arch_task_struct_size, src, sizeof(struct task_struct), 0);
>
> or even just
>
> memcpy(dst, src, sizeof(struct task_struct));
>
> fpu_clone() will initialize the "dst_fpu" memory correctly.
Unecessary paranoia on my part, please send a patch to simplify this.
> - fpu__drop() does
>
> /* PF_KTHREAD tasks do not use the FPU context area: */
> if (tsk->flags & (PF_KTHREAD | PF_USER_WORKER))
> return;
>
> and this is correct. But perhaps
>
> if (test_tsk_thread_flag(tsk, TIF_NEED_FPU_LOAD))
> return;
>
> makes more sense? PF_KTHREAD's should never clear TIF_NEED_FPU_LOAD,
> and this way we can avoid the unnecessary "fwait" if, say, the exiting
> task does context_switch() at least once on its way to exit_thread().
I think you are right here as well.
> - Finally, with or without these changes, it seems that the
> switch_fpu_prepare() + switch_fpu_finish() logic can be simplified,
> I'll write another email.
Thank you!
Ingo
Powered by blists - more mailing lists