Re: [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork

2015-03-21 Thread Aleksa Sarai
is alerting the subsystem that the association changed during a fork. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo

Re: [PATCH v4 2/2] cgroups: add a pids subsystem

2015-03-10 Thread Aleksa Sarai
because it has either weird side effects (b) or is just an odd feature (a). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo

Re: [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-11 Thread Aleksa Sarai
Hi Tejun, You can charge the parent's at can_attach(), remember which one you charged, and at post_fork() if the parent's has changed inbetween, fix it up. [...] Did you mean can_fork() instead of can_attach() here? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list

[PATCH v4 2/2] cgroups: add a pids subsystem

2015-03-05 Thread Aleksa Sarai
inside a cgroup without hitting any reasonable kmemcg policy. Once you've hit PID exhaustion, you're only in a marginally better state than OOM. This subsystem allows PID exhaustion inside a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h

[PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork

2015-03-13 Thread Aleksa Sarai
it to the right hierarchy using the reapply_fork callback. Since a changing current css_set in copy_process indicates an organisation operation took place, we can break the cgroup policy in this case. This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp

[PATCH v6 1/3] cgroups: use bitmask to filter for_each_subsys

2015-03-13 Thread Aleksa Sarai
Add a new macro for_each_subsys_which that allows all enabled cgroup subsystems to be filtered by a bitmask, such that mask (1 ssid) determines if the subsystem is to be processed in the loop body (where ssid is the unique id of the subsystem). Signed-off-by: Aleksa Sarai cyp...@cyphar.com

[PATCH v6 3/3] cgroups: add a pids subsystem

2015-03-13 Thread Aleksa Sarai
hit PID exhaustion, you're only in a marginally better state than OOM. This subsystem allows PID exhaustion inside a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 4 + init/Kconfig | 11 ++ kernel/Makefile

[PATCH v6 0/3] cgroups: add pids subsystem

2015-03-13 Thread Aleksa Sarai
an opaque pointer between cgroup_*_fork(), which holds the current task css_set. The css_set is pinned by bumping the refcount in cgroup_can_fork() and later unpinned in cgroup_{cancel,post}_fork(). * A whole bunch of userland API and stylistic fixes. Aleksa Sarai (3): cgroups: use

Re: [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-10 Thread Aleksa Sarai
Hello Tejun, On Wed, Mar 11, 2015 at 2:17 AM, Tejun Heo t...@kernel.org wrote: On Wed, Mar 11, 2015 at 01:51:06AM +1100, Aleksa Sarai wrote: Actually, I'm fairly sure we can do it all inside cgroup_post_fork() because inside cgroup_post_fork() we have access to both the old css_set and the new

Re: [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-10 Thread Aleksa Sarai
the charge to the hierarchies. I'll send a patch in a few days, I need to make sure that this method *actually* works. :P -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More

[PATCH v4 0/2] cgroup: add pids subsystem

2015-03-05 Thread Aleksa Sarai
/2015/3/4/1198 Aleksa Sarai (2): cgroups: allow a cgroup subsystem to reject a fork cgroups: add a pids subsystem include/linux/cgroup.h| 9 ++ include/linux/cgroup_subsys.h | 4 + init/Kconfig | 11 ++ kernel/Makefile | 1 + kernel/cgroup.c

[PATCH v4 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-05 Thread Aleksa Sarai
it belongs). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 9 ++ kernel/cgroup.c| 82 -- kernel/fork.c | 12 +++- 3 files changed

Re: [PATCH v4 2/2] cgroups: add a pids subsystem

2015-03-10 Thread Aleksa Sarai
and the pids cgroup controller are orthogonal features, why should they be able to affect each other (or even be aware of each other)? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More

Re: [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-10 Thread Aleksa Sarai
a certain `css` (unless we start passing `css_set`s to the fork/exit callbacks -- and then we can uncharge the old css_set and charge the new one). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord

Re: [PATCH v4 2/2] cgroups: add a pids subsystem

2015-03-11 Thread Aleksa Sarai
actually get per-cgroup process limiting merged first, then deal with such features separately. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http

[PATCH v7 4/4] cgroups: implement the PIDs subsystem

2015-03-31 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 4 + init/Kconfig | 16 +++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 310 ++ 4 files changed, 331

[PATCH v7 2/4] cgroups: replace explicit ss_mask checking with for_each_subsys_which

2015-03-31 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(ss_mask, ...), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 42 ++ 1 file changed

[PATCH v7 0/4] cgroups: add pids subsystem

2015-03-31 Thread Aleksa Sarai
to be enforced prematurely due to residual charges on the pid counter. This is done by adding a detach() callback that alerts a subsystem to a task detaching from it. [1]: https://lkml.org/lkml/2015/3/14/2 Aleksa Sarai (4): cgroups: use bitmask to filter for_each_subsys cgroups: replace

[PATCH v7 1/4] cgroups: use bitmask to filter for_each_subsys

2015-03-31 Thread Aleksa Sarai
Add a new macro for_each_subsys_which that allows all enabled cgroup subsystems to be filtered by a bitmask, such that mask (1 ssid) determines if the subsystem is to be processed in the loop body (where ssid is the unique id of the subsystem). Signed-off-by: Aleksa Sarai cyp...@cyphar.com

Re: [PATCH v7 0/4] cgroups: add pids subsystem

2015-03-31 Thread Aleksa Sarai
for no good reason). If you *really* want the other one, I can send it. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo

[PATCH v7 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-03-31 Thread Aleksa Sarai
to another hierarchy, add a detach callback to the subsystem which is run after the migration has been confirmed but before the old_cset's refcount is dropped. This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h

[PATCH v8 0/4] cgroups: add pids subsystem

2015-04-01 Thread Aleksa Sarai
://lkml.org/lkml/2015/3/31/1058 Aleksa Sarai (4): cgroups: use bitmask to filter for_each_subsys cgroups: replace explicit ss_mask checking with for_each_subsys_which cgroups: allow a cgroup subsystem to reject a fork cgroups: implement the PIDs subsystem include/linux/cgroup.h| 35

[PATCH v8 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-01 Thread Aleksa Sarai
subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 35 +++-- kernel/cgroup.c | 133 kernel/cgroup_freezer.c | 2 +- kernel/fork.c | 31 +-- kernel/sched/core.c | 2 +- 5

[PATCH v8 1/4] cgroups: use bitmask to filter for_each_subsys

2015-04-01 Thread Aleksa Sarai
separate bitmasks for each callback to make (ss-{fork,exit}) checks unnecessary. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c

[PATCH v8 2/4] cgroups: replace explicit ss_mask checking with for_each_subsys_which

2015-04-01 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(ss_mask, ...), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 42 ++ 1 file changed

[PATCH v8 4/4] cgroups: implement the PIDs subsystem

2015-04-01 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 4 + init/Kconfig | 16 ++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 367 ++ 4 files changed, 388

Re: [PATCH RFC 0/2] add nproc cgroup subsystem

2015-02-28 Thread Aleksa Sarai
the SYSRQ dance. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH RFC 0/2] add nproc cgroup subsystem

2015-03-02 Thread Aleksa Sarai
PIDs a resource. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[PATCH v3 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-03-04 Thread Aleksa Sarai
it belongs). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 9 ++ kernel/cgroup.c| 80 +++--- kernel/fork.c | 12 +++- 3 files changed

[PATCH v3 2/2] cgroups: add a pids subsystem

2015-03-04 Thread Aleksa Sarai
inside a cgroup without hitting any reasonable kmemcg policy. Once you've hit PID exhaustion, you're only in a marginally better state than OOM. This subsystem allows PID exhaustion inside a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h

[PATCH v3 0/2] cgroup: add pids subsystem

2015-03-04 Thread Aleksa Sarai
was renamed to `pids`. [1]: https://lkml.org/lkml/2015/2/26/787 [2]: https://lkml.org/lkml/2015/3/2/437 Aleksa Sarai (2): cgroups: allow a cgroup subsystem to reject a fork cgroups: add a pids subsystem include/linux/cgroup.h| 9 ++ include/linux/cgroup_subsys.h | 4 + init/Kconfig

Re: [PATCH v3 2/2] cgroups: add a pids subsystem

2015-03-05 Thread Aleksa Sarai
+ depends on PAGE_COUNTER Whoops. I forgot to remove this line. Should I submit a revised patchset or can you just change the patch? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord

[PATCH RFC 2/2] cgroups: add an nproc subsystem

2015-02-22 Thread Aleksa Sarai
a cgroup, allowing for cgroups to perform fairly basic resource limitation which it currently doesn't have the capability to do. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 4 + init/Kconfig | 10 +++ kernel/Makefile | 1 + kernel

[PATCH RFC 0/2] add nproc cgroup subsystem

2015-02-22 Thread Aleksa Sarai
to do such rudimentary resource management (which currently only exists for process trees). Aleksa Sarai (2): cgroups: allow a cgroup subsystem to reject a fork cgroups: add an nproc subsystem include/linux/cgroup.h| 9 ++- include/linux/cgroup_subsys.h | 4 + init/Kconfig

[PATCH RFC 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-02-22 Thread Aleksa Sarai
-- Make the cgroup subsystem post fork callback return an error code so that subsystems can accept or reject a fork from completing with a custom error value. This is in preparation for implementing the numtasks cgroup scope. Signed-off-by: Aleksa Sarai cyp

[PATCH v2 2/2] cgroups: add an nproc subsystem

2015-02-26 Thread Aleksa Sarai
a cgroup, allowing for cgroups to perform fairly basic resource limitation which it currently doesn't have the capability to do. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 4 + init/Kconfig | 10 +++ kernel/Makefile | 1 + kernel

[RFC PATCH v2 0/2] add nproc cgroup subsystem

2015-02-26 Thread Aleksa Sarai
is exposed (which is when fork) is called, and cancel_fork is run during the cleanup of copy_process if the fork fails due to other reasons. [1]: https://lkml.org/lkml/2015/2/22/204 Aleksa Sarai (2): cgroups: allow a cgroup subsystem to reject a fork cgroups: add an nproc subsystem include/linux

[PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork

2015-02-26 Thread Aleksa Sarai
it belongs). This is in preparation for implementing the nproc cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 9 ++ kernel/cgroup.c| 80 +++--- kernel/fork.c | 12 +++- 3 files changed

Re: [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork

2015-03-26 Thread Aleksa Sarai
. If a subsys doesn't have pre, it's NULL. I don't see anything weird about that, so let's please go that way. Alright, if you think that's the best way. I still think it's weird, but I guess that's probably just down to personal taste. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from

FWD: cgroups: pids v5 patchset review

2015-03-24 Thread Aleksa Sarai
use INT_MAX for now. 3. Please FWD this discussion to the mailing lists with a summary. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork

2015-03-26 Thread Aleksa Sarai
association. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v8 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-02 Thread Aleksa Sarai
IMO this should be done in a separate patchset [if at all]). Also, your later comments would fix the subsys bitmask problem (we can just pass the default %NULL), we don't even need to test the index. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-13 Thread Aleksa Sarai
() does. I can remove the UNUSED_IDENT() if you want, that was just to make sure you don't get clashes with other unused idents. COUNT() is so that we don't have to manually add CGROUP_TAG_COUNT for every tag we add. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send

[PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-19 Thread Aleksa Sarai
for CGROUP_TAG enumerations to be be defined and used (as well as CGROUP_TAG_COUNT). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h| 47 +- include/linux/cgroup_subsys.h | 27

[PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-04-19 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 5 + init/Kconfig | 16 ++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 368 ++ 4 files changed, 390

[PATCH v10 2/4] cgroups: replace explicit ss_mask checking with for_each_subsys_which

2015-04-19 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(ss_mask, ...), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 42 ++ 1 file changed

[PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys

2015-04-19 Thread Aleksa Sarai
separate bitmasks for each callback to make (ss-{fork,exit}) checks unnecessary. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c

[PATCH v10 0/4] cgroups: add pids subsystem

2015-04-19 Thread Aleksa Sarai
UNUSED_IDENT() magic) and not use __COUNTER__. * Removed the SUBSYS_TAG_COUNT macro and replaced it with a hard-coded CGROUP_PREFORK_COUNT macro. [1]: https://lkml.org/lkml/2015/4/11/237 Aleksa Sarai (4): cgroups: use bitmask to filter for_each_subsys cgroups: replace explicit ss_mask

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-04-24 Thread Aleksa Sarai
a ref on a css_set give you an implicit ref on a css inside that css_set, or are those two orthogonal operations? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-04-24 Thread Aleksa Sarai
this in the comments if you want. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org

Re: [PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-24 Thread Aleksa Sarai
the task is being migrated away from is and just uncharge that inside -can_attach. On the same point, are all the tasks in a tset passed to -can_attach guaranteed to have the same css? Or do I have to uncharge each one individually? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from

Re: [PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys

2015-04-26 Thread Aleksa Sarai
naive solution? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-04-22 Thread Aleksa Sarai
as the maximum valid value). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

[PATCH v11 0/7] cgroups: add pids subsystem

2015-05-15 Thread Aleksa Sarai
up a whole bunch of comments that were too pids-specific or not explicit enough. [1]: https://lkml.org/lkml/2015/4/19/39 [2]: http://lkml.kernel.org/g/1428350318-8215-8-git-send-email...@kernel.org Aleksa Sarai (6): cgroup: switch to unsigned long for bitmasks cgroup: use bitmask to filter

[PATCH v11 2/7] cgroup: use bitmask to filter for_each_subsys

2015-05-15 Thread Aleksa Sarai
separate bitmasks for each callback to make (ss-{fork,exit}) checks unnecessary. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 46 +- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-05-15 Thread Aleksa Sarai
Hi Tejun, One question RE: defaults for .config. What is the kernel policy for deciding if a particular subsystem should be made enabled-by-default? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord

[PATCH v11 1/7] cgroup: switch to unsigned long for bitmasks

2015-05-15 Thread Aleksa Sarai
Switch the type of all internal cgroup masks to (unsigned long), which is the correct type for bitmasks. This is in preparation for the for_each_subsys_which patch. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 39 --- 1 file changed, 20

[PATCH v11 5/7] cgroup: move enum cgroup_subsys_id definition

2015-05-15 Thread Aleksa Sarai
This patch is in preparation for the pids cgroup subsystem patchset. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index e7da0aa

[PATCH v11 6/7] cgroup: allow a cgroup subsystem to reject a fork

2015-05-15 Thread Aleksa Sarai
for CGROUP_TAG enumerations to be be defined and used (as well as CGROUP_TAG_COUNT). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h| 35 +++-- include/linux/cgroup_subsys.h | 17

[PATCH v11 4/7] cgroup, block: implement task_get_css() and use it in bio_associate_current()

2015-05-15 Thread Aleksa Sarai
From: Tejun Heo t...@kernel.org bio_associate_current() currently open codes task_css() and css_tryget_online() to find and pin $current's blkcg css. Abstract it into task_get_css() which is implemented from cgroup side. As a task is always associated with an online css for every subsystem

[PATCH v11 3/7] cgroup: replace explicit ss_mask checking with for_each_subsys_which

2015-05-15 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(..., ss_mask), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 44 1 file

[PATCH v11 7/7] cgroup: implement the PIDs subsystem

2015-05-15 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- CREDITS | 5 + include/linux/cgroup_subsys.h | 5 + init/Kconfig | 16 ++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 379

[PATCH v12 4/8] cgroup, block: implement task_get_css() and use it in bio_associate_current()

2015-05-18 Thread Aleksa Sarai
From: Tejun Heo t...@kernel.org bio_associate_current() currently open codes task_css() and css_tryget_online() to find and pin $current's blkcg css. Abstract it into task_get_css() which is implemented from cgroup side. As a task is always associated with an online css for every subsystem

[PATCH v12 5/8] cgroup: move enum cgroup_subsys_id definition

2015-05-18 Thread Aleksa Sarai
This is in preparation for implementing the pids cgroup subsystem. It is not a functional change and should not change any behavior. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git

[PATCH v12 2/8] cgroup: use bitmask to filter for_each_subsys

2015-05-18 Thread Aleksa Sarai
separate bitmasks for each callback to make (ss-{fork,exit}) checks unnecessary. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 51 +++ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/kernel/cgroup.c b/kernel

[PATCH v12 6/8] cgroup: allow a cgroup subsystem to reject a fork

2015-05-18 Thread Aleksa Sarai
a CGROUP_CANFORK_COUNT macro to make arrays easier to define. This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h| 27 -- include/linux/cgroup_subsys.h | 17 + kernel/cgroup.c | 84

[PATCH v12 7/8] cgroup: add a tset_get_css macro

2015-05-18 Thread Aleksa Sarai
This adds a macro to get the css of a tset (using task_get_css()) by just grabbing a ref to the first item in the tset (since there is a guarantee that all tasks in a tset share a css). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp

[PATCH v12 8/8] cgroup: implement the PIDs subsystem

2015-05-18 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- CREDITS | 5 + include/linux/cgroup_subsys.h | 5 + init/Kconfig | 16 ++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 355

[PATCH v12 0/8] cgroup: add pids subsystem

2015-05-18 Thread Aleksa Sarai
This is a small update to v11 of the pids patchset[1], including: * Fix up (incorrect) commit messages. * Remove defunct code. * Modify subsys_canfork_private{,p} signatures to use (void *[SUBSYS_CANFORK_COUNT]). [1]: https://lkml.org/lkml/2015/5/16/1 Aleksa Sarai (7): cgroup: switch

[PATCH v12 1/8] cgroup: switch to unsigned long for bitmasks

2015-05-18 Thread Aleksa Sarai
Switch the type of all internal cgroup masks to (unsigned long), which is the correct type for bitmasks. This is in preparation for the for_each_subsys_which patch. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 39 --- 1 file changed, 20

[PATCH v12 3/8] cgroup: replace explicit ss_mask checking with for_each_subsys_which

2015-05-18 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(..., ss_mask), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 44 1 file

Re: [PATCH v11 7/7] cgroup: implement the PIDs subsystem

2015-05-18 Thread Aleksa Sarai
I just realised I didn't remove a few incorrect comments and some of the other patches need a small amount of fixing up. I'll send a corrected patchset in an hour or so. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-05-13 Thread Aleksa Sarai
, no? Would you be okay with this? if (limit 0 || limit = PIDS_MAX) I'd prefer if we used PIDS_MAX as the maximum input value as well as being the internal representation of the maximum, rather than switching to something like INT_MAX. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from

Re: [PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-05-14 Thread Aleksa Sarai
if (CGROUP_PREFORK_START = ssid ssid CGROUP_PREFORK_END) return ss_state[ssid - CGROUP_PREFORK_START]; return NULL; What would be a nice name for it? I can't think of anything better than __get_ss_private() and __get_ss_privatep(). -- Aleksa Sarai (cyphar

Re: [PATCH v10 4/4] cgroups: implement the PIDs subsystem

2015-05-13 Thread Aleksa Sarai
for INT_MAX in the first place. Do you remember why we tried INT_MAX at all? Thanks. -- tejun I think it's because we didn't want to expose PIDS_MAX to userspace. But we're not *really* exposing it, we're just enforcing the input limit for max. -- Aleksa Sarai (cyphar) www.cyphar.com

Re: [PATCH v12 7/8] cgroup: add a tset_get_css macro

2015-05-18 Thread Aleksa Sarai
change between -can_attach() and -cancel_attach()). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read

Re: [PATCH v12 4/8] cgroup, block: implement task_get_css() and use it in bio_associate_current()

2015-05-18 Thread Aleksa Sarai
Hi Tejun, Applied 1-4 but skipped bio_associate_current() changes from this patch. I'll route that part through a different patchset. Do you want the updated versions of 6-8 of the patchset to be based on your tree's for-next? -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from

Re: [PATCH v12 5/8] cgroup: move enum cgroup_subsys_id definition

2015-05-18 Thread Aleksa Sarai
Hi Tejun, This is in preparation for implementing the pids cgroup subsystem. It is not a functional change and should not change any behavior. Signed-off-by: Aleksa Sarai cyp...@cyphar.com I did a big reorg of cgroup.h and split of cgroup-defs.h from it and this patch doesn't seem

Re: [PATCH v12 8/8] cgroup: implement the PIDs subsystem

2015-05-19 Thread Aleksa Sarai
] or after it checks [which means you'll hit the parent's limit and won't be able to fork]). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http

Re: [PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys

2015-05-12 Thread Aleksa Sarai
crazy and breaks stuff like: if (...) for_each_subsys_which(...) -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-16 Thread Aleksa Sarai
Hi, Do you also want me to completely drop the COUNT macro? IMO it makes the CGROUP_TAG_COUNT consolidation much nicer. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More

Re: [PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-17 Thread Aleksa Sarai
in semantics, but I'll do that if you prefer it that way. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read

Re: [PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-17 Thread Aleksa Sarai
CGROUP_TAGNAME_COUNT(CGROUP_TAGNAME_END - CGROUP_TAGNAME_START) At maximum, we're only gonna have a few of these. No reason to be smart about it. Yeah, that's fair I guess. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body

Re: [PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-17 Thread Aleksa Sarai
the range of a tagged section much easier. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ

[PATCH v9 0/4] cgroups: add pids subsystem

2015-04-11 Thread Aleksa Sarai
a tagging macro to cgroup_subsys.h, so that the ss_state array can be CGROUP_PREFORK_COUNT in size. [1]: https://lkml.org/lkml/2015/4/1/145 Aleksa Sarai (4): cgroups: use bitmask to filter for_each_subsys cgroups: replace explicit ss_mask checking with for_each_subsys_which cgroups: allow

[PATCH v9 4/4] cgroups: implement the PIDs subsystem

2015-04-11 Thread Aleksa Sarai
a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup_subsys.h | 5 + init/Kconfig | 16 ++ kernel/Makefile | 1 + kernel/cgroup_pids.c | 367 ++ 4 files changed, 389

[PATCH v9 2/4] cgroups: replace explicit ss_mask checking with for_each_subsys_which

2015-04-11 Thread Aleksa Sarai
Replace the explicit checking against ss_masks inside a for_each_subsys block with for_each_subsys_which(ss_mask, ...), to take advantage of the more readable macro. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 42 ++ 1 file changed

[PATCH v9 1/4] cgroups: use bitmask to filter for_each_subsys

2015-04-11 Thread Aleksa Sarai
separate bitmasks for each callback to make (ss-{fork,exit}) checks unnecessary. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c

[PATCH v9 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-11 Thread Aleksa Sarai
for CGROUP_TAG enumerations to be be defined and used (as well as CGROUP_TAG_COUNT). This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup.h| 67 +- include/linux/cgroup_subsys.h

Re: [PATCH v8 3/4] cgroups: allow a cgroup subsystem to reject a fork

2015-04-07 Thread Aleksa Sarai
code essentially unreadable). -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http

Re: [PATCH v12 8/8] cgroup: implement the PIDs subsystem

2015-05-19 Thread Aleksa Sarai
into child is violating the constraints and has to be refused. Anything else is just dirty hackery. Whoops. Yes, you're completely right. All right, I'll fix up the patchset in a few days. -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux

[PATCH v14 3/4] cgroup: allow a cgroup subsystem to reject a fork

2015-06-09 Thread Aleksa Sarai
a CGROUP_CANFORK_COUNT macro to make arrays easier to define. This is in preparation for implementing the pids cgroup subsystem. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- include/linux/cgroup-defs.h | 10 +- include/linux/cgroup.h| 15 +++-- include/linux/cgroup_subsys.h | 23

[PATCH v14 2/4] cgroup, block: implement task_get_css()

2015-06-09 Thread Aleksa Sarai
From: Tejun Heo t...@kernel.org Implement task_get_css() which find and pins the css for the specified task and subsys. As a task is always associated with an online css for every subsystem except while the css_set update is propagating, task_get_css() retries till css_tryget_online() succeeds.

[PATCH v14 1/4] cgroup: fix uninitialised iterator in for_each_subsys_which

2015-06-09 Thread Aleksa Sarai
Fix the fact that @ssid is uninitialised in the case where CGROUP_SUBSYS_COUNT = 0 by setting ssid to 0. Fixes: cb4a31675270 (cgroup: use bitmask to filter for_each_subsys) Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- kernel/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v14 4/4] cgroup: implement the PIDs subsystem

2015-06-09 Thread Aleksa Sarai
in a marginally better state than OOM. This subsystem allows PID exhaustion inside a cgroup to be prevented. Signed-off-by: Aleksa Sarai cyp...@cyphar.com --- CREDITS | 5 + include/linux/cgroup_subsys.h | 5 + init/Kconfig | 16 ++ kernel/Makefile | 1

[PATCH v14 0/4] cgroup: add PIDs subsystem

2015-06-09 Thread Aleksa Sarai
and kernel/cgroup.c. [1]: https://lkml.org/lkml/2015/6/5/857 Aleksa Sarai (3): cgroup: fix uninitialised iterator in for_each_subsys_which cgroup: allow a cgroup subsystem to reject a fork cgroup: implement the PIDs subsystem Tejun Heo (1): cgroup, block: implement task_get_css() CREDITS

Re: [PATCH v13 4/5] cgroup: allow a cgroup subsystem to reject a fork

2015-06-09 Thread Aleksa Sarai
the for_each_subsys_which API for iterating over active cgroups. :/ -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read

Re: [PATCH v11 7/7] cgroup: implement the PIDs subsystem

2015-06-05 Thread Aleksa Sarai
; cgroup_taskset_for_each(task, tset) css_put(task_css(task, pids_cgrp_id)); } -- Aleksa Sarai (cyphar) www.cyphar.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH v11 7/7] cgroup: implement the PIDs subsystem

2015-06-05 Thread Aleksa Sarai
err = pids_try_charge(pids, 1); if (err) goto out_fail; Disregard this and the revert code. This was from me testing making attach obey the set limit (which isn't going to in to the patchset). -- Aleksa Sarai (cyphar) www.cyphar.com

[PATCH v13 0/5] cgroup: add PIDs subsystem

2015-06-05 Thread Aleksa Sarai
/439 Aleksa Sarai (4): cgroup: use bitmask to filter for_each_subsys cgroup: replace explicit ss_mask checking with for_each_subsys_which cgroup: allow a cgroup subsystem to reject a fork cgroup: implement the PIDs subsystem Tejun Heo (1): cgroup, block: implement task_get_css() CREDITS

  1   2   3   4   5   6   7   8   9   >