forced comounts for cgroups.
Subsystems (4)
cover forced comounts for cgroups.
Hi,
As we have been extensively discussing, the cost and pain points for cgroups come from many places. But at least one of those is the arbitrary nature of hierarchies. Many people, including at least Tejun and me would like this to go away altogether. Problem so far, is breaking compatiblity with existing setups
I am proposing here a default-n Kconfig option that will guarantee that the cpu cgroups (for now) will be comounted. I started with them because the cpu/cpuacct division is clearly the worst offender. Also, the default-n is here so distributions will have time to adapt: Forcing this flag to be on without userspace changes will just lead to cgroups failing to mount, which we don't want.
Although I've tested it and it works, I haven't compile-tested all possible config combinations. So this is mostly for your eyes. If this gets traction, I'll submit it properly, along with any changes that you might require.
Thanks.
Glauber Costa (5):
cgroup: allow some comounts to be forced.
sched: adjust exec_clock to use it as cpu usage metric
sched: do not call cpuacct_charge when cpu and cpuacct are comounted
cpuacct: do not gather cpuacct statistics when not mounted
sched: add cpusets to comounts list
include/linux/cgroup.h | 6 ++ init/Kconfig | 23 ++++++++ kernel/cgroup.c | 29 +++++++++- kernel/cpuset.c | 4 ++ kernel/sched/core.c | 149 +++++++++++++++++++++++++++++++++++++++++++++---- kernel/sched/rt.c | 1 + kernel/sched/sched.h | 20 ++++++- 7 files changed, 220 insertions(+), 12 deletions(-)
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 1/5 cgroup: allow some comounts to be forced.
One of the pain points we have today with cgroups, is the excessive flexibility coming from the fact that controllers can be mounted at will, without any relationship with each other.
Although this is nice in principle, this comes with a cost that is not always welcome in practice. The very fact of this being possible is already enough to trigger those costs. We cannot assume a common hierarchy between controllers, and then hierarchy walks have to be done more than once. This happens in hotpaths as well.
This patch introduces a Kconfig option, default n, that will force some controllers to be comounted. After some time, we may be able to deprecate this mode of operation.
--- include/linux/cgroup.h | 6 ++++++ init/Kconfig | 4 ++++ kernel/cgroup.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-)
include/linux/cgroup.h +6 -0
@@ -531,6 +531,12 @@ struct cgroup_subsys {/* should be defined only by modular subsystems */ struct module *module; + +#ifdef CONFIG_CGROUP_FORCE_COMOUNT +/* List of groups that we must be comounted with */ +int comounts; +int must_comount[3 ]; +#endif };#define SUBSYS (_x) extern struct cgroup_subsys _x ## _subsys;
init/Kconfig +4 -0
@@ -680,6 +680,10 @@ config CGROUP_CPUACCT Provides a simple Resource Controller for monitoring the total CPU consumed by the tasks in a cgroup. +config CGROUP_FORCE_COMOUNT + bool + default n + config RESOURCE_COUNTERS bool "Resource counters" help
kernel/cgroup.c +28 -1
@@ -1058,6 +1058,33 @@ static int rebind_subsystems(struct cgroupfs_root *root,if (root->number_of_cgroups >1 )return -EBUSY ; +#ifdef CONFIG_CGROUP_FORCE_COMOUNT +/* +* Some subsystems should not be allowed to be freely mounted in +* separate hierarchies. They may not be present, but if they are, they +* should be together. For compatibility with older kernels, we'll allow +* this to live inside a separate Kconfig option. Each subsys will be +* able to tell us which other subsys it expects to be mounted with. +* +* We do a separate path for this, to avoid unwinding our modifications +* in case of an error. +*/ +for (i =0 ; i <CGROUP_SUBSYS_COUNT ; i++) { +unsigned long bit =1UL << i; +int j; + +if (!(bit & added_bits)) +continue ; + +for (j =0 ; j < subsys[i]->comounts; j++) { +int comount_id = subsys[i]->must_comount[j]; +struct cgroup_subsys *ss = subsys[comount_id]; +if ((ss->root != &rootnode) && (ss->root != root)) +return -EINVAL ; + } + } +#endif +/* Process each subsystem */ for (i =0 ; i <CGROUP_SUBSYS_COUNT ; i++) {struct cgroup_subsys *ss = subsys[i];
@@ -1634,7 +1661,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, goto unlock_drop; ret =rebind_subsystems (root, root->subsys_bits); -if (ret == -EBUSY ) { +if ((ret == -EBUSY ) || (ret == -EINVAL )) {free_cg_links (&tmp_cg_links); goto unlock_drop; }
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 2/5 sched: adjust exec_clock to use it as cpu usage metric
In reply to Glauber Costaexec_clock already provides per-group cpu usage metrics, and can be reused by cpuacct in case cpu and cpuacct are comounted.
However, it is only provided by tasks in fair class. Doing the same for rt is easy, and can be done in an already existing hierarchy loop. This is an improvement over the independent hierarchy walk executed by cpuacct.
--- kernel/sched/rt.c | 1 + kernel/sched/sched.h | 3 +++ 2 files changed, 4 insertions(+)
kernel/sched/rt.c +1 -0
@@ -930,6 +930,7 @@ static void update_curr_rt(struct rq *rq)for_each_sched_rt_entity (rt_se) { rt_rq =rt_rq_of_se (rt_se); +schedstat_add (rt_rq, exec_clock, delta_exec);if (sched_rt_runtime (rt_rq) !=RUNTIME_INF ) {raw_spin_lock (&rt_rq->rt_runtime_lock);
kernel/sched/sched.h +3 -0
@@ -204,6 +204,7 @@ struct cfs_rq {unsigned int nr_running, h_nr_running;u64 exec_clock; +u64 prev_exec_clock;u64 min_vruntime;#ifndef CONFIG_64BIT u64 min_vruntime_copy;
@@ -295,6 +296,8 @@ struct rt_rq {struct plist_head pushable_tasks;#endif int rt_throttled; +u64 exec_clock; +u64 prev_exec_clock;u64 rt_time;u64 rt_runtime;/* Nests inside the rq lock: */
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 3/5 sched: do not call cpuacct_charge when cpu and cpuacct are comounted
In reply to Glauber Costacpuacct_charge() incurs in some quite expensive operations to achieve its measurement goal. To make matters worse, this cost is not constant, but grows with the depth of the cgroup hierarchy tree. Also, all this data is already available anyway in the scheduler core.
The fact that the cpuacct cgroup cannot be guaranteed to be mounted in the same hierarchy as the scheduler core cgroup (cpu), forces us to go gather them all again.
With the introduction of CONFIG_CGROUP_FORCE_COMOUNT_CPU, we will be able to be absolutely sure that such a coupling exists. After that, the hierarchy walks can be completely abandoned.
--- init/Kconfig | 19 +++++++ kernel/sched/core.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++---- kernel/sched/sched.h | 14 ++++- 3 files changed, 163 insertions(+), 11 deletions(-)
init/Kconfig +19 -0
@@ -684,6 +684,25 @@ config CGROUP_FORCE_COMOUNT bool default n +config CGROUP_FORCE_COMOUNT_CPU + bool "Enforce single hierarchy for the cpu related cgroups" + depends on CGROUP_SCHED || CPUSETS || CGROUP_CPUACCT + select SCHEDSTATS + select CGROUP_FORCE_COMOUNT + default n + help + Throughout cgroup's life, it was always possible to mount the + controllers in completely independent hierarchies. However, the + costs incurred by allowing are considerably big. Hotpaths in the + scheduler needs to call expensive hierarchy walks more than once in + the same place just to account for the fact that multiple controllers + can be mounted in different places. + + Setting this option will disallow cpu, cpuacct and cpuset to be + mounted in different hierarchies. Distributions are highly encouraged + to set this option and comount those groups. + + config RESOURCE_COUNTERS bool "Resource counters" help
kernel/sched/core.c +131 -10
213 lines not on this page · raw message
kernel/sched/sched.h +13 -1
@@ -885,6 +885,9 @@ extern void update_idle_cpu_load(struct rq *this_rq); #ifdef CONFIG_CGROUP_CPUACCT #include <linux/cgroup.h> + +extern bool cpuacct_from_cpu; + /* track cpu usage of a group of tasks and its child groups */ struct cpuacct { struct cgroup_subsys_state css;
@@ -914,7 +917,16 @@ static inline struct cpuacct *parent_ca(struct cpuacct *ca) return cgroup_ca(ca->css.cgroup->parent); } -extern void cpuacct_charge (struct task_struct *tsk,u64 cputime); +extern void __cpuacct_charge (struct task_struct *tsk,u64 cputime); + +static inline void cpuacct_charge (struct task_struct *tsk,u64 cputime) +{ +#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU +if (likely (!cpuacct_from_cpu)) +return ; +#endif +__cpuacct_charge (tsk, cputime); +}#else static inline void cpuacct_charge (struct task_struct *tsk,u64 cputime) {}#endif
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 4/5 cpuacct: do not gather cpuacct statistics when not mounted
In reply to Glauber CostaCurrently, the only test that prevents us from running the expensive cpuacct_charge() is cpuacct_subsys.active == true. This will hold at all times after the subsystem is activated, even if it is not mounted.
IOW, use it or not, you pay it. By hooking with the bind() callback, we can detect when cpuacct is mounted or umounted, and stop collecting statistics when this cgroup is not in use.
--- kernel/sched/core.c | 8 ++++++++ kernel/sched/sched.h | 3 +++ 2 files changed, 11 insertions(+)
kernel/sched/core.c +8 -0
@@ -8595,6 +8595,13 @@ static struct cftype files[] = { { }/* terminate */ }; +bool cpuacct_mounted; + +void cpuacct_bind (struct cgroup *root) +{ + cpuacct_mounted = root->root == root_cpuacct.css.cgroup->root; +} +/* * charge this task's execution time to its accounting group. *
@@ -8628,6 +8635,7 @@ struct cgroup_subsys cpuacct_subsys = { .destroy = cpuacct_destroy, .subsys_id = cpuacct_subsys_id, .base_cftypes = files, + .bind = cpuacct_bind, #ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU .comounts =1 , .must_comount = { cpu_cgroup_subsys_id, },
kernel/sched/sched.h +3 -0
@@ -887,6 +887,7 @@ extern void update_idle_cpu_load(struct rq *this_rq);#include <linux/cgroup.h> extern bool cpuacct_from_cpu; +extern bool cpuacct_mounted;/* track cpu usage of a group of tasks and its child groups */ struct cpuacct {
@@ -921,6 +922,8 @@ extern void __cpuacct_charge(struct task_struct *tsk, u64 cputime);static inline void cpuacct_charge (struct task_struct *tsk,u64 cputime) { +if (unlikely (!cpuacct_mounted)) +return ;#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU if (likely (!cpuacct_from_cpu))return ;
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 5/5 sched: add cpusets to comounts list
In reply to Glauber CostaAlthough we have not yet identified any place where cpusets could be improved performance-wise by guaranteeing comounts with the other two cpu cgroups, it is a sane choice to mount them together.
We can preemptively benefit from it and avoid a growing mess, by guaranteeing that subsystems that mostly contraint the same kind of resource will live together. With cgroups is never that simple, and things crosses boundaries quite often. But I hope this can be seen as a potential improvement.
--- kernel/cpuset.c | 4 ++++ kernel/sched/core.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
kernel/cpuset.c +4 -0
@@ -1879,6 +1879,10 @@ struct cgroup_subsys cpuset_subsys = { .post_clone = cpuset_post_clone, .subsys_id = cpuset_subsys_id, .base_cftypes = files, +#ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU + .comounts =2 , + .must_comount = { cpu_cgroup_subsys_id, cpuacct_subsys_id, }, +#endif .early_init = 1, };
kernel/sched/core.c +4 -4
@@ -8301,8 +8301,8 @@ struct cgroup_subsys cpu_cgroup_subsys = { .subsys_id = cpu_cgroup_subsys_id, .base_cftypes = cpu_files, #ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU - .comounts =1 , - .must_comount = { cpuacct_subsys_id, }, + .comounts =2 , + .must_comount = { cpuacct_subsys_id, cpuset_subsys_id, }, .bind = cpu_cgroup_bind, #endif .early_init = 1,
@@ -8637,8 +8637,8 @@ struct cgroup_subsys cpuacct_subsys = { .base_cftypes = files, .bind = cpuacct_bind, #ifdef CONFIG_CGROUP_FORCE_COMOUNT_CPU - .comounts = 1, - .must_comount = { cpu_cgroup_subsys_id, }, + .comounts =2 , + .must_comount = { cpu_cgroup_subsys_id, cpuset_subsys_id, }, #endif };#endif /* CONFIG_CGROUP_CPUACCT */
Signature · 7 lines
1.7.11.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerHello, Glauber.
Quoted 12 lines · Glauber Costa
As we have been extensively discussing, the cost and pain points for cgroups come from many places. But at least one of those is the arbitrary nature of hierarchies. Many people, including at least Tejun and me would like this to go away altogether. Problem so far, is breaking compatiblity with existing setups
I am proposing here a default-n
Kconfigoption that will guarantee that the cpu cgroups (for now) will be comounted. I started with them because the cpu/cpuacct division is clearly the worst offender. Also, the default-n is here so distributions will have time to adapt: Forcing this flag to be on without userspace changes will just lead to cgroups failing to mount, which we don't want.
Quoted 3 lines
Although I've tested it and it works, I haven't compile-tested all possible config combinations. So this is mostly for your eyes. If this gets traction, I'll submit it properly, along with any changes that you might require.
As I said during the discussion, I'm skeptical about how useful this is. This can't nudge existing users in any meaningfully gradual way. Kconfig doesn't make it any better. It's still an abrupt behavior change when seen from userland.
Also, I really don't see much point in enforcing this almost arbitrary grouping of controllers. It doesn't simplify anything and using cpuacct in more granular way than cpu actually is one of the better justified use of multiple hierarchies. Also, what about memcg and blkcg? Do they *really* coincide? Note that both blkcg and memcg involve non-trivial overhead and blkcg is essentially broken hierarchy-wise.
Currently, from userland visible behavior POV, the crazy parts are
1. The flat hierarchy thing. This just should go away.
2. Orthogonal multiple hierarchies.
I think we agree that #1 should go away one way or the other. I *really* wanna get rid of #2 but am not sure how. I'll give it another stab once the writeback thing is resolved.
Thanks.
Signature · 1 line
tejun
Quoted 15 lines · Tejun Heo
Hello, Glauber.
Quoted 12 lines · Glauber Costa
As we have been extensively discussing, the cost and pain points for cgroups come from many places. But at least one of those is the arbitrary nature of hierarchies. Many people, including at least Tejun and me would like this to go away altogether. Problem so far, is breaking compatiblity with existing setups
I am proposing here a default-n
Kconfigoption that will guarantee that the cpu cgroups (for now) will be comounted. I started with them because the cpu/cpuacct division is clearly the worst offender. Also, the default-n is here so distributions will have time to adapt: Forcing this flag to be on without userspace changes will just lead to cgroups failing to mount, which we don't want.
Quoted 9 lines
Quoted 3 lines
Although I've tested it and it works, I haven't compile-tested all possible config combinations. So this is mostly for your eyes. If this gets traction, I'll submit it properly, along with any changes that you might require.
As I said during the discussion, I'm skeptical about how useful this is. This can't nudge existing users in any meaningfully gradual way.
Kconfigdoesn't make it any better. It's still an abrupt behavior change when seen from userland.
The goal here is to have distributions to do it, because they tend to have a well defined lifecycle management, much more than upstream. Whoever sets this option, can coordinate with upstream.
Aside from enforcing it, we can pretty much warn() as well, to direct people towards flipping the switch.
Quoted 8 lines
Also, I really don't see much point in enforcing this almost arbitrary grouping of controllers. It doesn't simplify anything and using cpuacct in more granular way than cpu actually is one of the better justified use of multiple hierarchies. Also, what about memcg and blkcg? Do they *really* coincide? Note that both blkcg and memcg involve non-trivial overhead and blkcg is essentially broken hierarchy-wise.
Where did I mention memcg or blkcg in this patch ?
Tejun Heo
maintainerHello, Glauber.
Quoted 3 lines · Glauber Costa
The goal here is to have distributions to do it, because they tend to have a well defined lifecycle management, much more than upstream. Whoever sets this option, can coordinate with upstream.
Distros can just co-mount them during boot. What's the point of the config options?
Quoted 9 lines
Quoted 7 lines
Also, I really don't see much point in enforcing this almost arbitrary grouping of controllers. It doesn't simplify anything and using cpuacct in more granular way than cpu actually is one of the better justified use of multiple hierarchies. Also, what about memcg and blkcg? Do they *really* coincide? Note that both blkcg and memcg involve non-trivial overhead and blkcg is essentially broken hierarchy-wise.
Where did I mention memcg or blkcg in this patch ?
Differing hierarchies in memcg and blkcg currently is the most prominent case where the intersection in writeback is problematic and your proposed solution doesn't help one way or the other. What's the point?
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Tejun Heo
Hello, Glauber.
Quoted 3 lines · Glauber Costa
The goal here is to have distributions to do it, because they tend to have a well defined lifecycle management, much more than upstream. Whoever sets this option, can coordinate with upstream.
Distros can just co-mount them during boot. What's the point of the config options?
Pretty simple. The kernel can't assume the distro did. And then we still need to pay a stupid big price in the scheduler.
After this patchset, We can assume this. And cpuusage can totally be derived from the cpu cgroup. Because much more than "they can comount", we can assume they did.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Also, I really don't see much point in enforcing this almost arbitrary grouping of controllers. It doesn't simplify anything and using cpuacct in more granular way than cpu actually is one of the better justified use of multiple hierarchies. Also, what about memcg and blkcg? Do they *really* coincide? Note that both blkcg and memcg involve non-trivial overhead and blkcg is essentially broken hierarchy-wise.
Quoted 7 lines
Quoted 1 line
Where did I mention memcg or blkcg in this patch ?
Differing hierarchies in memcg and blkcg currently is the most prominent case where the intersection in writeback is problematic and your proposed solution doesn't help one way or the other. What's the point?
The point is that I am focusing at one problem at a time. But FWIW, I don't see why memcg/blkcg can't use a step just like this one in a separate pass.
If the goal is comounting them eventually, at some point when the issues are sorted out, just do it. Get a switch like this one, and then you will start being able to assume a lot of things in the code. Miracles can happen.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerHello, Glauber.
Quoted 9 lines · Glauber Costa
Quoted 2 lines
Distros can just co-mount them during boot. What's the point of the config options?
Pretty simple. The kernel can't assume the distro did. And then we still need to pay a stupid big price in the scheduler.
After this patchset, We can assume this. And cpuusage can totally be derived from the cpu cgroup. Because much more than "they can comount", we can assume they did.
As long as cpuacct and cpu are separate, I think it makes sense to assume that they at least could be at different granularity. As for optimization for co-mounted case, if that is *really* necessary, couldn't it be done dynamically? It's not like CONFIG_XXX blocks are pretty things and they're worse for runtime code path coverage.
Quoted 5 lines
Quoted 4 lines
Differing hierarchies in memcg and blkcg currently is the most prominent case where the intersection in writeback is problematic and your proposed solution doesn't help one way or the other. What's the point?
Quoted 8 lines
The point is that I am focusing at one problem at a time. But FWIW, I don't see why memcg/blkcg can't use a step just like this one in a separate pass.
If the goal is comounting them eventually, at some point when the issues are sorted out, just do it. Get a switch like this one, and then you will start being able to assume a lot of things in the code. Miracles can happen.
The problem is that I really don't see how this leads to where we eventually wanna be. Orthogonal hierarchies are bad because,
* It complicates the code. This doesn't really help there much.
* Intersections between controllers are cumbersome to handle. Again, this doesn't help much.
And this restricts the only valid use case for multiple hierarchies which is applying differing level of granularity depending on controllers. So, I don't know. Doesn't seem like a good idea to me.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Tejun Heo
Hello, Glauber.
Quoted 6 lines · Glauber Costa
Quoted 2 lines
Distros can just co-mount them during boot. What's the point of the config options?
Pretty simple. The kernel can't assume the distro did. And then we still need to pay a stupid big price in the scheduler.
Quoted 6 lines
Quoted 3 lines
After this patchset, We can assume this. And cpuusage can totally be derived from the cpu cgroup. Because much more than "they can comount", we can assume they did.
As long as cpuacct and cpu are separate, I think it makes sense to assume that they at least could be at different granularity.
If they are comounted, and more: forceably comounted, I don't see how to call them separate. At the very best, they are this way for compatibility purposes only, to lay a path that would allow us to get rid of the separation eventually.
Quoted 5 lines
As for
optimization for co-mounted case, if that is *really* necessary, couldn't it be done dynamically? It's not likeCONFIG_XXXblocks are pretty things and they're worse for runtime code path coverage.
I've done it dynamically, as you know. But if you think that complicated the code less than this, we're operating by very different standards...
CONFIG options can make the code uglier, but it is a lot more predictable. It also guarantee no state changes will happen during the lifecycle of the machine. Doing it dynamically makes the code prettier, but still extensively large, and prone to subtle bugs, as we've already seen in practice.
Quoted 14 lines
Quoted 5 lines
Quoted 4 lines
Differing hierarchies in memcg and blkcg currently is the most prominent case where the intersection in writeback is problematic and your proposed solution doesn't help one way or the other. What's the point?
Quoted 8 lines
The point is that I am focusing at one problem at a time. But FWIW, I don't see why memcg/blkcg can't use a step just like this one in a separate pass.
If the goal is comounting them eventually, at some point when the issues are sorted out, just do it. Get a switch like this one, and then you will start being able to assume a lot of things in the code. Miracles can happen.
Quoted 5 lines
The problem is that I really don't see how this leads to where we eventually wanna be. Orthogonal hierarchies are bad because,
* It complicates the code. This doesn't really help there much.
Way I see it, it is the price we pay for having screwed up before. And Kconfig options doesn't necessarily complicate the code. They make it bigger, and possibly slightly harder to follow. But I myself
Quoted 3 lines
* Intersections between controllers are cumbersome to handle. Again, this doesn't help much.
They are only cumbersome because we can't assume nothing. The cpuacct is the perfect example. Once we can start assuming, they become a lot less so.
Quoted 6 lines
And this restricts the only valid use case for multiple hierarchies which is applying differing level of granularity depending on controllers. So, I don't know. Doesn't seem like a good idea to me.
Thanks.
Tejun Heo
maintainerHello, Glauber.
Quoted 7 lines · Glauber Costa
Quoted 2 lines
As long as cpuacct and cpu are separate, I think it makes sense to assume that they at least could be at different granularity.
If they are comounted, and more: forceably comounted, I don't see how to call them separate. At the very best, they are this way for compatibility purposes only, to lay a path that would allow us to get rid of the separation eventually.
I think this is where we disagree. I didn't mean that all controllers should be using exactly the same hierarchy when I was talking about unified hierarchy. I do think it's useful and maybe even essential to allow differing levels of granularity. cpu and cpuacct could be a valid example for this. Likely blkcg and memcg too.
So, I think it's desirable for all controllers to be able to handle hierarchies the same way and to have the ability to tag something as belonging to certain group in the hierarchy for all controllers but I don't think it's desirable or feasible to require all of them to follow exactly the same grouping at all levels.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 17 lines · Tejun Heo
Hello, Glauber.
Quoted 7 lines · Glauber Costa
Quoted 2 lines
As long as cpuacct and cpu are separate, I think it makes sense to assume that they at least could be at different granularity.
If they are comounted, and more: forceably comounted, I don't see how to call them separate. At the very best, they are this way for compatibility purposes only, to lay a path that would allow us to get rid of the separation eventually.
I think this is where we disagree. I didn't mean that all controllers should be using exactly the same hierarchy when I was talking about unified hierarchy. I do think it's useful and maybe even essential to allow differing levels of granularity. cpu and cpuacct could be a valid example for this. Likely blkcg and memcg too.
Quoted 6 lines
So, I think it's desirable for all controllers to be able to handle hierarchies the same way and to have the ability to tag something as belonging to certain group in the hierarchy for all controllers but I don't think it's desirable or feasible to require all of them to follow exactly the same grouping at all levels.
By "different levels of granularity" do you mean having just a subset of them turned on at a particular place?
If yes, having them guaranteed to be comounted is still perceived by me as a good first step. A natural following would be to turn them on/off on a per-group basis.
Quoted 11 lines · Tejun Heo
I think this is where we disagree. I didn't mean that all controllers should be using exactly the same hierarchy when I was talking about unified hierarchy. I do think it's useful and maybe even essential to allow differing levels of granularity. cpu and cpuacct could be a valid example for this. Likely blkcg and memcg too.
So, I think it's desirable for all controllers to be able to handle hierarchies the same way and to have the ability to tag something as belonging to certain group in the hierarchy for all controllers but I don't think it's desirable or feasible to require all of them to follow exactly the same grouping at all levels.
*confused* I always thought that was exactly what you meant with unified hierarchy.
Doing all this runtime is just going to make the mess even bigger, because now we have to deal with even more stupid cases.
So either we go and try to contain this mess as proposed by Glauber or we go delete controllers.. I've had it with this crap.
--- Documentation/cgroups/00-INDEX | 2 - Documentation/cgroups/cpuacct.txt | 49 -------- include/linux/cgroup_subsys.h | 6 - init/Kconfig | 6 - kernel/sched/core.c | 247 -------------------------------------- kernel/sched/fair.c | 1 - kernel/sched/rt.c | 1 - kernel/sched/sched.h | 45 ------- kernel/sched/stop_task.c | 1 - 9 files changed, 358 deletions(-)
Documentation/cgroups/00-INDEX +0 -2
@@ -2,8 +2,6 @@ - this file cgroups.txt - Control Groups definition, implementation details, examples and API. -cpuacct.txt - - CPU Accounting Controller; account CPU usage for groups of tasks. cpusets.txt - documents the cpusets feature; assign CPUs and Mem to a set of tasks. devices.txt
Documentation/cgroups/cpuacct.txt deleted +0 -49
49 lines not on this page · raw message
include/linux/cgroup_subsys.h +0 -6
@@ -25,12 +25,6 @@ SUBSYS(cpu_cgroup)/* */ -#ifdef CONFIG_CGROUP_CPUACCT -SUBSYS(cpuacct) -#endif - -/* */ -#ifdef CONFIG_MEMCG SUBSYS(mem_cgroup)#endif
init/Kconfig +0 -6
@@ -674,12 +674,6 @@ config PROC_PID_CPUSET depends on CPUSETS default y -config CGROUP_CPUACCT - bool "Simple CPU accounting cgroup subsystem" - help - Provides a simple Resource Controller for monitoring the - total CPU consumed by the tasks in a cgroup. - config RESOURCE_COUNTERS bool "Resource counters" help
kernel/sched/core.c +0 -247
271 lines not on this page · raw message
kernel/sched/fair.c +0 -1
@@ -706,7 +706,6 @@ static void update_curr(struct cfs_rq *cfs_rq)struct task_struct *curtask =task_of (curr);trace_sched_stat_runtime (curtask, delta_exec, curr->vruntime); -cpuacct_charge (curtask, delta_exec);account_group_exec_runtime (curtask, delta_exec); }
kernel/sched/rt.c +0 -1
@@ -934,7 +934,6 @@ static void update_curr_rt(struct rq *rq)account_group_exec_runtime (curr, delta_exec); curr->se.exec_start = rq->clock_task; -cpuacct_charge (curr, delta_exec);sched_rt_avg_update (rq, delta_exec);
kernel/sched/sched.h +0 -45
57 lines not on this page · raw message
kernel/sched/stop_task.c +0 -1
@@ -68,7 +68,6 @@ static void put_prev_task_stop(struct rq *rq, struct task_struct *prev)account_group_exec_runtime (curr, delta_exec); curr->se.exec_start = rq->clock_task; -cpuacct_charge (curr, delta_exec); }static void task_tick_stop (struct rq *rq,struct task_struct *curr,int queued)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Tejun Heo
Hello, Glauber.
Quoted 6 lines · Glauber Costa
Quoted 5 lines
So, I think it's desirable for all controllers to be able to handle hierarchies the same way and to have the ability to tag something as belonging to certain group in the hierarchy for all controllers but I don't think it's desirable or feasible to require all of them to follow exactly the same grouping at all levels.
Quoted 5 lines
Quoted 2 lines
By "different levels of granularity" do you mean having just a subset of them turned on at a particular place?
Heh, this is tricky to describe and I'm not really following what you mean.
Do we really want to start cleaning up all this by changing the interface to something that is described as "tricky" ?
Peter Zijlstra
maintainerQuoted 5 lines · Peter Zijlstra
So either we go and try to contain this mess as proposed by Glauber or we go delete controllers.. I've had it with this crap.
Glauber, the other approach is sending a patch that doesn't touch cgroup.c but only the controllers and I'll merge it regardless of what tj thinks.
We need some movement here.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerHello, Glauber.
Quoted 8 lines · Glauber Costa
Quoted 5 lines
So, I think it's desirable for all controllers to be able to handle hierarchies the same way and to have the ability to tag something as belonging to certain group in the hierarchy for all controllers but I don't think it's desirable or feasible to require all of them to follow exactly the same grouping at all levels.
By "different levels of granularity" do you mean having just a subset of them turned on at a particular place?
Heh, this is tricky to describe and I'm not really following what you mean. They're all on the same tree but a controller should be able to handle a given subtree as single group. e.g. if you draw the tree, different controllers should be able to draw different enclosing circles and operate on the simplifed tree. How flexible that should be, I don't know. Maybe it would be enough to be able to say "treat all children of this node as belonging to this node for controllers X and Y".
Quoted 3 lines
If yes, having them guaranteed to be comounted is still perceived by me as a good first step. A natural following would be to turn them on/off on a per-group basis.
I don't agree with that. If we do it that way, we would lose differing granularity from forcing co-mounting and then restore it later when the subtree handling is implemented. If we can do away with differing granularity, that's fine; otherwise, it doesn't make much sense to remove and then restore it.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerHello, Peter.
Quoted 2 lines · Peter Zijlstra
*confused* I always thought that was exactly what you meant with unified hierarchy.
No, I never counted out differing granularity.
Quoted 5 lines
Doing all this runtime is just going to make the mess even bigger, because now we have to deal with even more stupid cases.
So either we go and try to contain this mess as proposed by Glauber or we go delete controllers.. I've had it with this crap.
If cpuacct can really go away, that's great, but I don't think the problem at hand is unsolvable, so let's not jump it. cpuacct and cpu aren't the onlfy problem cases after all. We need to solve it for other controllers too.
Thanks.
Signature · 1 line
tejun
Quoted 8 lines · Tejun Heo
Hello, Peter.
Quoted 2 lines · Peter Zijlstra
*confused* I always thought that was exactly what you meant with unified hierarchy.
No, I never counted out differing granularity.
Can you elaborate on which interface do you envision to make it work? They will clearly be mounted in the same hierarchy, or as said alternatively, comounted.
If you can turn them on/off on a per-subtree basis, which interface exactly do you propose for that?
Would a pair of cgroup core files like available_controllers and current_controllers are a lot of drivers do, suffice?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerQuoted 5 lines · Glauber Costa
Quoted 2 lines
Heh, this is tricky to describe and I'm not really following what you mean.
Do we really want to start cleaning up all this by changing the interface to something that is described as "tricky" ?
The concept is not tricky. I just can't find the appropriate words. I *suspect* this can mostly re-use the existing css_set thing. It mostly becomes that css_set belongs to the unified hierarchy rather than each task. The user interface part isn't trivial and maybe "don't nest beyond this level" is the only thing reasonable. Not sure yet whether that would be enough tho. Need to think more about it.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerQuoted 5 lines · Glauber Costa
Quoted 1 line
No, I never counted out differing granularity.
Can you elaborate on which interface do you envision to make it work? They will clearly be mounted in the same hierarchy, or as said alternatively, comounted.
I'm not sure yet. At the simplest, mask of controllers which should honor (or ignore) nesting beyond the node. That should be understandable enough. Not sure whether that would be flexible enough yet tho. In the end, they should be comounted but again I don't think enforcing comounting at the moment is a step towards that. It's more like a step sideways.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerHey,
Quoted 5 lines · Peter Zijlstra
Glauber, the other approach is sending a patch that doesn't touch
cgroup.cbut only the controllers and I'll merge it regardless of what tj thinks.We need some movement here.
Peter, I don't think the proposed patch is helpful at this point. While movement is necessary, it's not like moving towards any direction is helpful. They might just become another cruft which needs to be maintained.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Glauber Costa
Quoted 8 lines · Tejun Heo
Hello, Peter.
Quoted 2 lines · Peter Zijlstra
*confused* I always thought that was exactly what you meant with unified hierarchy.
No, I never counted out differing granularity.
Quoted 6 lines
Can you elaborate on which interface do you envision to make it work? They will clearly be mounted in the same hierarchy, or as said alternatively, comounted.
If you can turn them on/off on a per-subtree basis, which interface exactly do you propose for that?
I wouldn't, screw that. That would result in the exact same problem we're trying to fix. I want a single hierarchy walk, that's expensive enough.
Quoted 2 lines
Would a pair of cgroup core files like
available_controllersandcurrent_controllersare a lot of drivers do, suffice?
No.. its not a 'feature' I care to support for 'my' controllers.
I simply don't want to have to do two (or more) hierarchy walks for accounting on every schedule event, all that pointer chasing is stupidly expensive.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Tejun Heo
Quoted 5 lines · Glauber Costa
Quoted 1 line
No, I never counted out differing granularity.
Can you elaborate on which interface do you envision to make it work? They will clearly be mounted in the same hierarchy, or as said alternatively, comounted.
Quoted 7 lines
I'm not sure yet. At the simplest, mask of controllers which should honor (or ignore) nesting beyond the node. That should be understandable enough. Not sure whether that would be flexible enough yet tho. In the end, they should be comounted but again I don't think enforcing comounting at the moment is a step towards that. It's more like a step sideways.
Tejun,
From the code PoV, guaranteed comounting is what allow us to make optimizations. "Maybe comounting" will maybe simplify the interface, but will buy us nothing in the performance level.
I am more than happy to respin it with an added interface for masking cgroups, if you believe this is a requirement.
But hinting me about what you would like to see on that front would be really helpful.
Re-asking my question:
cpufreq, clocksources, ftrace, etc, they all use an interface that at this point can be considered quite standard.
Applying the same logic, each cgroup would have a pair of files:
available_controllers, current_controllers, that you can just control by writing to.
This can get slightly funny when we consider the right semantics for the hierarchy, but really, everything will. And it is not like we'll have anything crazy, we just need to tailor it with care.
If you think there is any chance of this getting us somewhere, I'll code it. But that would be something to be sent *together* with what I've just done. As I've said, if we can't guarantee the comounting, we would still lose all the optimization opportunities.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 22 lines · Peter Zijlstra
Quoted 10 lines · Glauber Costa
Quoted 8 lines · Tejun Heo
Hello, Peter.
Quoted 2 lines · Peter Zijlstra
*confused* I always thought that was exactly what you meant with unified hierarchy.
No, I never counted out differing granularity.
Quoted 6 lines
Can you elaborate on which interface do you envision to make it work? They will clearly be mounted in the same hierarchy, or as said alternatively, comounted.
If you can turn them on/off on a per-subtree basis, which interface exactly do you propose for that?
I wouldn't, screw that. That would result in the exact same problem we're trying to fix. I want a single hierarchy walk, that's expensive enough.
Quoted 9 lines
Quoted 2 lines
Would a pair of cgroup core files like
available_controllersandcurrent_controllersare a lot of drivers do, suffice?No.. its not a 'feature' I care to support for 'my' controllers.
I simply don't want to have to do two (or more) hierarchy walks for accounting on every schedule event, all that pointer chasing is stupidly expensive.
You wouldn't have to do more than one hierarchy walks for that. What Tejun seems to want, is the ability to not have a particular controller at some point in the tree. But if they exist, they are always together.
Tejun Heo
maintainerHey, again.
Quoted 5 lines · Peter Zijlstra
Doing all this runtime is just going to make the mess even bigger, because now we have to deal with even more stupid cases.
So either we go and try to contain this mess as proposed by Glauber or we go delete controllers.. I've had it with this crap.
cpuacct is rather unique tho. I think it's gonna be silly whether the hierarchy is unified or not.
1. If they always can live on the exact same hierarchy, there's no point in having the two separate. Just merge them.
2. If they need differing levels of granularity, they either need to do it completely separately as they do now or have some form of dynamic optimization if absolutely necesary.
So, I think that choice is rather separate from other issues. If cpuacct is gonna be kept, I'd just keep it separate and warn that it incurs extra overhead for the current users if for nothing else. Otherwise, kill it or merge it into cpu.
Thanks.
Signature · 1 line
tejun
Tejun Heo
maintainerHello,
Quoted 7 lines · Glauber Costa
Quoted 3 lines
I simply don't want to have to do two (or more) hierarchy walks for accounting on every schedule event, all that pointer chasing is stupidly expensive.
You wouldn't have to do more than one hierarchy walks for that. What Tejun seems to want, is the ability to not have a particular controller at some point in the tree. But if they exist, they are always together.
Nope, as I wrote in the other reply, for cpu and cpuacct, either just merge them or kill cpuacct if you want to avoid silliness from walking multiple times. Does cpuset cause problem in this regard too? Or can it be handled similarly to other controllers?
I think the confusion here is that we're talking about two different issues. As for cpuacct, I can see why strict co-mounting can be attractive but then again if that's gonna be required, there's no point in having them separate, right? If that's the way you want it, just trigger WARN_ON() if cpu and cpuacct aren't co-mounted and later on kill cpuacct.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Tejun Heo
Hello,
Quoted 7 lines · Glauber Costa
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
I simply don't want to have to do two (or more) hierarchy walks for accounting on every schedule event, all that pointer chasing is stupidly expensive.
You wouldn't have to do more than one hierarchy walks for that. What Tejun seems to want, is the ability to not have a particular controller at some point in the tree. But if they exist, they are always together.
Nope, as I wrote in the other reply,
Would you mind, then, stopping for a moment and telling us what it is, then, that you envision?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerQuoted 4 lines · Glauber Costa
Quoted 1 line
Nope, as I wrote in the other reply,
Would you mind, then, stopping for a moment and telling us what it is, then, that you envision?
I thought I already explained it a couple times in this thread (also in the big thread from several months ago). It's nearing three in the morning here. I'll try to explain it better tomorrow.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 15 lines · Tejun Heo
Hey, again.
Quoted 5 lines · Peter Zijlstra
Doing all this runtime is just going to make the mess even bigger, because now we have to deal with even more stupid cases.
So either we go and try to contain this mess as proposed by Glauber or we go delete controllers.. I've had it with this crap.
cpuacct is rather unique tho. I think it's gonna be silly whether the hierarchy is unified or not.
1. If they always can live on the exact same hierarchy, there's no point in having the two separate. Just merge them.
Quoted 8 lines
2. If they need differing levels of granularity, they either need to do it completely separately as they do now or have some form of dynamic optimization if absolutely necesary.
So, I think that choice is rather separate from other issues. If cpuacct is gonna be kept, I'd just keep it separate and warn that it incurs extra overhead for the current users if for nothing else. Otherwise, kill it or merge it into cpu.
Quite, hence my 'proposal' to remove cpuacct.
There was some whining last time Glauber proposed this, but the one whining never convinced and has gone away from Linux, so lets just do this.
Lets make cpuacct print a deprecated msg to dmesg for a few releases and make cpu do all this.
The co-mounting stuff would have been nice for cpusets as well, knowing all your tasks are affine to a subset of cpus allows for a few optimizations (smaller cpumask iterations), but I guess we'll have to do that dynamically, we'll just have to see how ugly that is.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Glauber Costa
You wouldn't have to do more than one hierarchy walks for that. What Tejun seems to want, is the ability to not have a particular controller at some point in the tree. But if they exist, they are always together.
Right, but the accounting is very much tied to the control structures, I suppose we could change that, but my jet-leg addled brain isn't seeing anything particularly nice atm.
But I don't really see the point though, this kind of interface would only ever work for the non-controlling and controlling controller combination (confused yet ;-), and I don't think we have many of those.
I would really rather see a simplification of the entire cgroup interface space as opposed to making it more complex. And adding this subtree 'feature' only makes it more complex.
Tejun Heo
maintainerHello, Peter, Glauber.
(I'm gonna write up cgroup core todos which should explain / address this issue too. ATM I'm a bit overwhelmed with stuff accumulated while traveling.)
Quoted 3 lines · Peter Zijlstra
But I don't really see the point though, this kind of interface would only ever work for the non-controlling and controlling controller combination (confused yet ;-), and I don't think we have many of those.
It's more than that. One may not want to apply the same level of granularity to different resources. e.g. depending on the setup, IOs may need to be further categorized and controlled than memory or vice versa.
Quoted 3 lines
I would really rather see a simplification of the entire cgroup interface space as opposed to making it more complex. And adding this subtree 'feature' only makes it more complex.
It does in the meantime but I think most of it can piggyback on the existing css_set mechanism. No matter what we do, this isn't gonna be a short and easy transition. More than half of the controllers don't even support proper hierarchy yet. We can't move to any kind of unified hierarchy without getting that settled first. I *think* I have a plan which can mostly work now. I'll write more later.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Tejun Heo
maintainerHello,
cc'ing Dhaval and Frederic. They were interested in the subject before and Dhaval was pretty vocal about cpuacct having a separate hierarchy (or at least granularity).
Quoted 15 lines · Peter Zijlstra
Quoted 6 lines
cpuacct is rather unique tho. I think it's gonna be silly whether the hierarchy is unified or not.
1. If they always can live on the exact same hierarchy, there's no point in having the two separate. Just merge them.
Quoted 8 lines
2. If they need differing levels of granularity, they either need to do it completely separately as they do now or have some form of dynamic optimization if absolutely necesary.
So, I think that choice is rather separate from other issues. If cpuacct is gonna be kept, I'd just keep it separate and warn that it incurs extra overhead for the current users if for nothing else. Otherwise, kill it or merge it into cpu.
Quoted 8 lines
Quite, hence my 'proposal' to remove cpuacct.
There was some whining last time Glauber proposed this, but the one whining never convinced and has gone away from Linux, so lets just do this.
Lets make cpuacct print a deprecated msg to dmesg for a few releases and make cpu do all this.
I like it. Currently cpuacct is the only problematic one in this regard (cpuset to a much lesser extent) and it would be great to make it go away.
Dhaval, Frederic, Paul, if you guys object, please voice your opinions.
Quoted 4 lines
The co-mounting stuff would have been nice for cpusets as well, knowing all your tasks are affine to a subset of cpus allows for a few optimizations (smaller cpumask iterations), but I guess we'll have to do that dynamically, we'll just have to see how ugly that is.
Forced co-mounting sounds rather silly to me. If the two are always gonna be co-mounted, why not just merge them and switch the functionality depending on configuration? I'm fairly sure the code would be simpler that way.
If cpuset and cpu being separate is important enough && the overhead of doing things separately for cpuset isn't too high, I wouldn't bother too much with dynamic optimization but that's your call.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Tejun Heo
Hello,
cc'ing Dhaval and Frederic. They were interested in the subject before and Dhaval was pretty vocal about cpuacct having a separate hierarchy (or at least granularity).
Really? Time just has _not_ borne out this use-case. I'll let Dhaval make a case for this but he should expect violent objection.
Quoted 38 lines · Peter Zijlstra
Quoted 15 lines
Quoted 6 lines
cpuacct is rather unique tho. I think it's gonna be silly whether the hierarchy is unified or not.
1. If they always can live on the exact same hierarchy, there's no point in having the two separate. Just merge them.
Quoted 8 lines
2. If they need differing levels of granularity, they either need to do it completely separately as they do now or have some form of dynamic optimization if absolutely necesary.
So, I think that choice is rather separate from other issues. If cpuacct is gonna be kept, I'd just keep it separate and warn that it incurs extra overhead for the current users if for nothing else. Otherwise, kill it or merge it into cpu.
Quoted 8 lines
Quite, hence my 'proposal' to remove cpuacct.
There was some whining last time Glauber proposed this, but the one whining never convinced and has gone away from Linux, so lets just do this.
Lets make cpuacct print a deprecated msg to dmesg for a few releases and make cpu do all this.
I like it. Currently cpuacct is the only problematic one in this regard (cpuset to a much lesser extent) and it would be great to make it go away.
Dhaval, Frederic, Paul, if you guys object, please voice your opinions.
Quoted 4 lines
The co-mounting stuff would have been nice for cpusets as well, knowing all your tasks are affine to a subset of cpus allows for a few optimizations (smaller cpumask iterations), but I guess we'll have to do that dynamically, we'll just have to see how ugly that is.
Quoted 4 lines
Forced co-mounting sounds rather silly to me. If the two are always gonna be co-mounted, why not just merge them and switch the functionality depending on configuration? I'm fairly sure the code would be simpler that way.
It would be simpler but the problem is we'd break any userspace that was just doing mount cpuacct?
Further, even if it were mounting both, userspace code still has to be changed to read from "cpu.export" instead of "cpuacct.export".
I think a sane path on this front is:
Immediately:
Don't allow cpuacct and cpu to be co-mounted on separate hierarchies simultaneously.
That is:
mount none /dev/cgroup/cpuacct -t cgroupfs -o cpuacct : still works mount none /dev/cgroup/cpu -t cgroupfs -o cpu : still works mount none /dev/cgroup/cpux -t cgroupfs -o cpuacct,cpu : still works
But the combination:
mount none /dev/cgroup/cpu -t cgroupfs -o cpu : still works mount none /dev/cgroup/cpuacct -t cgroupfs -o cpu : EINVAL [or vice versa].
Also:WARN_ON when mounting cpuacct without cpu, strongly explaining that ANY such configuration is deprecated.
Glauber's patchset goes most of the way towards enabling this.
In a release or two:
Make the restriction strict; don't allow individual mounting of cpuacct, force it to be mounted ONLY with cpu.
Glauber's patchset gives us this.
Finally:
Mirror the interfaces to cpu, print nasty syslog messages about ANY mounts of cpuacct
Follow that up by eventually removing cpuacct completely
--
In general I think this sets a hard precedent of never allowing an accounting controller to exist with a control one for a given area, e.g. cpu, networking, mm, etc.
In the cases where one of these exists already, any attempts to extend (acounting or control) must extend the existing.
Quoted 5 lines
If cpuset and cpu being separate is important enough && the overhead of doing things separately for cpuset isn't too high, I wouldn't bother too much with dynamic optimization but that's your call.
Given the choice we would just straight out ripped it out long ago. Breaking the user-space ABI is the problem.
Quoted 4 lines
Thanks.
--
tejun
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Paul Turner
Quoted 5 lines · Tejun Heo
Hello,
cc'ing Dhaval and Frederic. They were interested in the subject before and Dhaval was pretty vocal about cpuacct having a separate hierarchy (or at least granularity).
Really? Time just has _not_ borne out this use-case. I'll let Dhaval make a case for this but he should expect violent objection.
I strongly advise against physical violence. In case it is really necessary, please break his legs only.
Quoted 42 lines
Quoted 37 lines · Peter Zijlstra
Quoted 15 lines
Quoted 6 lines
cpuacct is rather unique tho. I think it's gonna be silly whether the hierarchy is unified or not.
1. If they always can live on the exact same hierarchy, there's no point in having the two separate. Just merge them.
Quoted 8 lines
2. If they need differing levels of granularity, they either need to do it completely separately as they do now or have some form of dynamic optimization if absolutely necesary.
So, I think that choice is rather separate from other issues. If cpuacct is gonna be kept, I'd just keep it separate and warn that it incurs extra overhead for the current users if for nothing else. Otherwise, kill it or merge it into cpu.
Quoted 8 lines
Quite, hence my 'proposal' to remove cpuacct.
There was some whining last time Glauber proposed this, but the one whining never convinced and has gone away from Linux, so lets just do this.
Lets make cpuacct print a deprecated msg to dmesg for a few releases and make cpu do all this.
I like it. Currently cpuacct is the only problematic one in this regard (cpuset to a much lesser extent) and it would be great to make it go away.
Dhaval, Frederic, Paul, if you guys object, please voice your opinions.
Quoted 4 lines
The co-mounting stuff would have been nice for cpusets as well, knowing all your tasks are affine to a subset of cpus allows for a few optimizations (smaller cpumask iterations), but I guess we'll have to do that dynamically, we'll just have to see how ugly that is.
Quoted 4 lines
Forced co-mounting sounds rather silly to me. If the two are always gonna be co-mounted, why not just merge them and switch the functionality depending on configuration? I'm fairly sure the code would be simpler that way.
Quoted 6 lines
It would be simpler but the problem is we'd break any userspace that was just doing mount cpuacct?
Further, even if it were mounting both, userspace code still has to be changed to read from "cpu.export" instead of "cpuacct.export".
Only if we remove cpuacct. What we can do, and I thought about doing, is just merging cpuacct functionality into cpu. Then we move cpuacct to default no. It will be there for userspace if they absolutely want to use it.
Quoted 6 lines
I think a sane path on this front is:
Immediately:
Don't allow cpuacct and cpu to be co-mounted on separate hierarchies simultaneously.
that is precisely what my patch does, except it is a bit more generic.
Quoted 9 lines
That is:
mount none/dev/cgroup/cpuacct-t cgroupfs -o cpuacct : still works mount none/dev/cgroup/cpu-t cgroupfs -o cpu : still works mount none/dev/cgroup/cpux-t cgroupfs -o cpuacct,cpu : still worksBut the combination:
mount none/dev/cgroup/cpu-t cgroupfs -o cpu : still works mount none/dev/cgroup/cpuacct-t cgroupfs -o cpu : EINVAL [or vice versa].
Quoted 6 lines
Also:
WARN_ONwhen mounting cpuacct without cpu, strongly explaining that ANY such configuration is deprecated.Glauber's patchset goes most of the way towards enabling this.
yes.
Quoted 11 lines
In a release or two:
Make the restriction strict; don't allow individual mounting of cpuacct, force it to be mounted ONLY with cpu.Glauber's patchset gives us this.
Finally:
Mirror the interfaces to cpu, print nasty syslog messages about ANY mounts of cpuacct
Follow that up by eventually removing cpuacct completely
Why don't start with mirroring? It gives more time for people to start switching to it.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Tejun Heo
Hello, Peter, Glauber.
(I'm gonna write up cgroup core todos which should explain / address this issue too. ATM I'm a bit overwhelmed with stuff accumulated while traveling.)
Yes, please.
While you rightfully claim that you explained it a couple of times, it all seems to be quite fuzzy. I don't blame it on you: the current state of the interface leads to this.
So another detailed explanation of what you envision at this point, considering the discussions we had in the previous days, would be really helpful,
Tejun Heo
maintainerHello, Glauber.
Quoted 5 lines · Glauber Costa
Yes, please.
While you rightfully claim that you explained it a couple of times, it all seems to be quite fuzzy. I don't blame it on you: the current state of the interface leads to this.
Heh, I drank two cups of coffee and two glasses of wine that evening. Coffee won and I couldn't sleep till around 4am with splitting headache. I'm not too confident about what I wrote that night. :)
Quoted 3 lines
So another detailed explanation of what you envision at this point, considering the discussions we had in the previous days, would be really helpful,
Definitely, will do. Please give me a few days to sort through immediately pending stuff.
Thanks.
Signature · 1 line
tejun
Quoted 10 lines · Paul Turner
Quoted 5 lines · Tejun Heo
Hello,
cc'ing Dhaval and Frederic. They were interested in the subject before and Dhaval was pretty vocal about cpuacct having a separate hierarchy (or at least granularity).
Really? Time just has _not_ borne out this use-case. I'll let Dhaval make a case for this but he should expect violent objection.
I am not objecting directly! I am aware of a few users who are (or at least were) using cpu and cpuacct separately because they want to be able to account without control. Having said that, there are tons of flaws in the current approach, because the accounting without control is just plain wrong. I have copied a few other folks who might be able to shed light on those users and if we should still consider them.
[And the lesser number of controllers, the better it is!]
Thanks!
Dhaval
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>