Re: [GIT PULL] KVM changes for Linux 6.14

Linus Torvalds
2025-01-26T18:34:36Z

On Sun, 26 Jan 2025 at 06:21, Oleg Nesterov <oleg@redhat.com> wrote:
>
> > Should we just add some flag to say "don't show this thread in this
> > context"?
>
> Not sure I understand... Looking at is_single_threaded() above I guess
> something like below should work (incomplete, in particular we need to
> chang first_tid() as well).

So yes, I was thinking something similar, but:

> But a PF_HIDDEN sub-thread will still be visible via /proc/$pid_of_PF_HIDDEN
>
> > We obviously still want to see it for management purposes,
> > so it's not like the thing should be entirely invisible,
>
> Can you explain?

I was literally thinking that instead of a "hidden" flag, it would be
a "self-hidden" flag.

So if somebody _else_ (notably the sysadmin) does "ps" they see the
kernel thread as a subthread.

But when you look at your own /proc/self/task/ listing, you only see
your own explicit threads. So that "is_singlethreaded()" logic works.

Maybe that's just too ugly for words, and the kvm workaround is better.

Linus