Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1602522
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups |
| Date | 2017-03-16 16:30 +0100 |
| Message-ID | <tlFvH-gv-9@gated-at.bofh.it> (permalink) |
| References | <tlqmZ-6ih-3@gated-at.bofh.it> <tlqmZ-6ih-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 03/15, Tejun Heo wrote:
>
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -2425,11 +2425,13 @@ ssize_t __cgroup_procs_write(struct kern
> tsk = tsk->group_leader;
>
> /*
> - * Workqueue threads may acquire PF_NO_SETAFFINITY and become
> - * trapped in a cpuset, or RT worker may be born in a cgroup
> - * with no rt_runtime allocated. Just say no.
> + * kthreads may acquire PF_NO_SETAFFINITY during initialization.
> + * If userland migrates such kthread to a non-root cgroup, it can
> + * become trapped in a cpuset, or RT kthread may be born in a
> + * cgroup with no rt_runtime allocated. Just say no.
> */
> - if (tsk == kthreadd_task || (tsk->flags & PF_NO_SETAFFINITY)) {
> + if (tsk == kthreadd_task || (tsk->flags & PF_NO_SETAFFINITY) ||
> + ((tsk->flags & PF_KTHREAD) && !kthread_initialized(tsk))) {
> ret = -EINVAL;
...
> +bool kthread_initialized(struct task_struct *k)
> +{
> + struct kthread *kthread = to_kthread(k);
> +
> + return kthread && test_bit(KTHREAD_INITIALIZED, &kthread->flags);
> +}
Not sure I understand...
With this patch you can no longer migrate a kernel thread created by
kernel_thread() ? Note that to_kthread() is NULL unless it was created
by kthread_create().
Oleg.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 00:20 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Oleg Nesterov <oleg@redhat.com> - 2017-03-16 16:30 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Oleg Nesterov <oleg@redhat.com> - 2017-03-16 16:50 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 17:10 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Oleg Nesterov <oleg@redhat.com> - 2017-03-16 17:40 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 18:50 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 17:10 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Oleg Nesterov <oleg@redhat.com> - 2017-03-16 17:30 +0100
Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 18:20 +0100
[PATCH v2] cgroup, kthread: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-16 22:10 +0100
Re: [PATCH v2] cgroup, kthread: close race window where new kthreads can be migrated to non-root cgroups Oleg Nesterov <oleg@redhat.com> - 2017-03-17 15:00 +0100
Re: [PATCH v2] cgroup, kthread: close race window where new kthreads can be migrated to non-root cgroups Tejun Heo <tj@kernel.org> - 2017-03-17 15:50 +0100
csiph-web