Thread (5 messages) 5 messages, 2 authors, 2025-01-16

Re: [PATCH v1] sched: Mention autogroup disabled behavior

From: Alejandro Colomar <alx@kernel.org>
Date: 2025-01-16 13:59:10
Also in: lkml

Hi Phil,

On Thu, Jan 16, 2025 at 08:53:15AM -0500, Phil Auld wrote:
This is actually part of the problem. It's very hard to see this
from userspace. I can show a shell session that shows that autogroup
is disabled and that my task has an autogroup in /proc but determining
that the autogroup is not being used not so much. (I may be missing
something obvious but I could not find it).

I had to look at the kernel code:

kernel/sched/autogroup.h:
static inline struct task_group *
autogroup_task_group(struct task_struct *p, struct task_group *tg)
{
        extern unsigned int sysctl_sched_autogroup_enabled;
        int enabled = READ_ONCE(sysctl_sched_autogroup_enabled);

        if (enabled && task_wants_autogroup(p, tg))
                return p->signal->autogroup->tg;

        return tg;
}

bool task_wants_autogroup(struct task_struct *p, struct task_group *tg)
{
        if (tg != &root_task_group)
                return false;
    ...

}

The former being called from sched_group_fork() and sched_get_task_group().

I suppose looking at /proc/pid/cgroup and seeing it report not "0::/"
is part of it since it then won't be in root task group.

To some extent any systemd based system these days is not really
using autogroup at all anyway. 

I can put some of the above in there or just something like:

# cat /proc/sys/kernel/sched_autogroup_enabled 
0
# cat /proc/$$/autogroup 
/autogroup-112 nice 0


Thoughts?
Both.  :)

The more information we have in the commit message, the better (in case
someone needs to check in the future, that will give more context).


Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help