Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-25 Thread Gao feng
On 09/25/2013 08:23 AM, Lennart Poettering wrote:
> On Tue, 24.09.13 08:36, Gao feng (gaof...@cn.fujitsu.com) wrote:
> 
 Some programs need to set the memory.use_hierarchy(such as libvirt),
 Add this feature.
>>>
>>> As mentioned already: this really shouldn't be configurable but simply
>>> the unconditional configuration that systemd requires. I have hence now
>>> commited a different patch that strictly enables this option at
>>> boot-time in the root memory hierarchy and does not turn this into yet
>>> another user config switch.
>>
>> So administrator has no rights to set use_hierarchy to false?
> 
> Yes. use_hierarchy=0 is a bad idea, and exists only for legacy
> reasons. Since we kinda break compat with the systemd-based cgroup
> rework this should not exist in systemd ever, especially since Tejun
> already clearly said that this option will go away in the kernel too,
> and will be implicitly on.
> 
>> This patchset enables use_hierarchy for unit by default. but give
>> users the rights to disable this.
> 
> We should never blindly add more options for users, unless the interface
> is known to be useful and nicely designed, and if we know the setting
> has a future. This option is both badly designed on the kernel side and
> has no future on the kernel side hence it really doesn't belong in
> systemd's interfaces.

Thanks you guys.

Seems I need to read the future works of cgroup. :)

Thanks
Gao
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-24 Thread Lennart Poettering
On Tue, 24.09.13 08:42, Gao feng (gaof...@cn.fujitsu.com) wrote:

> 
> On 09/24/2013 08:36 AM, Gao feng wrote:
> > On 09/24/2013 05:06 AM, Lennart Poettering wrote:
> >> On Mon, 23.09.13 14:30, Gao feng (gaof...@cn.fujitsu.com) wrote:
> >>
> >>> Some programs need to set the memory.use_hierarchy(such as libvirt),
> >>> Add this feature.
> >>
> >> As mentioned already: this really shouldn't be configurable but simply
> >> the unconditional configuration that systemd requires. I have hence now
> >> commited a different patch that strictly enables this option at
> >> boot-time in the root memory hierarchy and does not turn this into yet
> >> another user config switch.
> > 
> > So administrator has no rights to set use_hierarchy to false?
> 
> If so, there is no need for kernel to export this file to user space.

Yes, that's why Tejun and friends are working on getting rid of it in
the kernel, too.


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-24 Thread Lennart Poettering
On Tue, 24.09.13 08:36, Gao feng (gaof...@cn.fujitsu.com) wrote:

> >> Some programs need to set the memory.use_hierarchy(such as libvirt),
> >> Add this feature.
> > 
> > As mentioned already: this really shouldn't be configurable but simply
> > the unconditional configuration that systemd requires. I have hence now
> > commited a different patch that strictly enables this option at
> > boot-time in the root memory hierarchy and does not turn this into yet
> > another user config switch.
> 
> So administrator has no rights to set use_hierarchy to false?

Yes. use_hierarchy=0 is a bad idea, and exists only for legacy
reasons. Since we kinda break compat with the systemd-based cgroup
rework this should not exist in systemd ever, especially since Tejun
already clearly said that this option will go away in the kernel too,
and will be implicitly on.

> This patchset enables use_hierarchy for unit by default. but give
> users the rights to disable this.

We should never blindly add more options for users, unless the interface
is known to be useful and nicely designed, and if we know the setting
has a future. This option is both badly designed on the kernel side and
has no future on the kernel side hence it really doesn't belong in
systemd's interfaces.

Sorry, 

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-24 Thread Kay Sievers
On Tue, Sep 24, 2013 at 2:42 AM, Gao feng  wrote:
> On 09/24/2013 08:36 AM, Gao feng wrote:
>> On 09/24/2013 05:06 AM, Lennart Poettering wrote:
>>> On Mon, 23.09.13 14:30, Gao feng (gaof...@cn.fujitsu.com) wrote:
>>>
 Some programs need to set the memory.use_hierarchy(such as libvirt),
 Add this feature.
>>>
>>> As mentioned already: this really shouldn't be configurable but simply
>>> the unconditional configuration that systemd requires. I have hence now
>>> commited a different patch that strictly enables this option at
>>> boot-time in the root memory hierarchy and does not turn this into yet
>>> another user config switch.
>>
>> So administrator has no rights to set use_hierarchy to false?
>
> If so, there is no need for kernel to export this file to user space.

Right, and it will go away on the kernel side with the "unified hierarchy".

Systemd must not export kernel details which we already know will not
survive in the future.

Systemd should be as close as possible to the envisioned *future*
behavior, and not to the status quo.

It makes not much sense to export knobs today in public systemd APIs,
which we expect to make no sense in the next year. Hence, we always
and unconditionally enable the hierarchy now.

Thanks,
Kay
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-23 Thread Gao feng
On 09/24/2013 08:36 AM, Gao feng wrote:
> On 09/24/2013 05:06 AM, Lennart Poettering wrote:
>> On Mon, 23.09.13 14:30, Gao feng (gaof...@cn.fujitsu.com) wrote:
>>
>>> Some programs need to set the memory.use_hierarchy(such as libvirt),
>>> Add this feature.
>>
>> As mentioned already: this really shouldn't be configurable but simply
>> the unconditional configuration that systemd requires. I have hence now
>> commited a different patch that strictly enables this option at
>> boot-time in the root memory hierarchy and does not turn this into yet
>> another user config switch.
> 
> So administrator has no rights to set use_hierarchy to false?

If so, there is no need for kernel to export this file to user space.

> This patchset enables use_hierarchy for unit by default. but give
> users the rights to disable this.
> 
>>
>> THis is what Tejun suggested to do and is also what makes the most sense
>> to me. cgroups after all are organized logically in a tree and it is
>> simply contradictory ignore this all and pretend everything was flat...
>>
>>> ---
>>>  src/core/cgroup.c |  6 ++
>>>  src/core/cgroup.h |  1 +
>>>  src/core/dbus-cgroup.c| 16 
>>>  src/core/load-fragment-gperf.gperf.m4 |  1 +
>>>  4 files changed, 24 insertions(+)
>>>
>>> diff --git a/src/core/cgroup.c b/src/core/cgroup.c
>>> index d10f205..68615c3 100644
>>> --- a/src/core/cgroup.c
>>> +++ b/src/core/cgroup.c
>>> @@ -32,6 +32,7 @@ void cgroup_context_init(CGroupContext *c) {
>>>  /* Initialize everything to the kernel defaults, assuming the
>>>   * structure is preinitialized to 0 */
>>>  
>>> +c->memory_hierarchy = true;
>>>  c->cpu_shares = 1024;
>>>  c->memory_limit = (uint64_t) -1;
>>>  c->blockio_weight = 1000;
>>> @@ -263,6 +264,11 @@ void cgroup_context_apply(CGroupContext *c, 
>>> CGroupControllerMask mask, const cha
>>>  
>>>  if (r < 0)
>>>  log_error("Failed to set memory.limit_in_bytes on 
>>> %s: %s", path, strerror(-r));
>>> +
>>> +r = cg_set_attribute("memory", path, 
>>> "memory.use_hierarchy", c->memory_hierarchy ? "1" : "0");
>>> +
>>> +if (r < 0)
>>> +log_error("Failed to set memory.use_hierarchy on 
>>> %s: %s", path, strerror(-r));
>>>  }
>>>  
>>>  if (mask & CGROUP_DEVICE) {
>>> diff --git a/src/core/cgroup.h b/src/core/cgroup.h
>>> index 0a079e9..f87c16a 100644
>>> --- a/src/core/cgroup.h
>>> +++ b/src/core/cgroup.h
>>> @@ -69,6 +69,7 @@ struct CGroupContext {
>>>  bool cpu_accounting;
>>>  bool blockio_accounting;
>>>  bool memory_accounting;
>>> +bool memory_hierarchy;
>>>  
>>>  unsigned long cpu_shares;
>>>  
>>> diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
>>> index 9ebcad9..a8a5f81 100644
>>> --- a/src/core/dbus-cgroup.c
>>> +++ b/src/core/dbus-cgroup.c
>>> @@ -132,6 +132,7 @@ const BusProperty bus_cgroup_context_properties[] = {
>>>  { "BlockIOReadBandwidth",bus_cgroup_append_device_bandwidths, 
>>> "a(st)", 0   },
>>>  { "BlockIOWriteBandwidth",   bus_cgroup_append_device_bandwidths, 
>>> "a(st)", 0   },
>>>  { "MemoryAccounting",bus_property_append_bool,
>>> "b", offsetof(CGroupContext, memory_accounting)  },
>>> +{ "MemoryHierarchy", bus_property_append_bool,
>>> "b", offsetof(CGroupContext, memory_hierarchy)   },
>>>  { "MemoryLimit", bus_property_append_uint64,  
>>> "t", offsetof(CGroupContext, memory_limit)   },
>>>  { "DevicePolicy",bus_cgroup_append_device_policy, 
>>> "s", offsetof(CGroupContext, device_policy)  },
>>>  { "DeviceAllow", bus_cgroup_append_device_allow,  
>>> "a(ss)", 0   },
>>> @@ -417,6 +418,21 @@ int bus_cgroup_set_property(
>>>  
>>>  return 1;
>>>  
>>> +} else if (streq(name, "MemoryHierarchy")) {
>>> +
>>> +if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_BOOLEAN)
>>> +return -EINVAL;
>>> +
>>> +if (mode != UNIT_CHECK) {
>>> +dbus_bool_t b;
>>> +dbus_message_iter_get_basic(i, &b);
>>> +
>>> +c->memory_hierarchy = b;
>>> +unit_write_drop_in_private(u, mode, name, b ? 
>>> "MemoryHierarchy=yes" : "MemoryHierarchy=no");
>>> +}
>>> +
>>> +return 1;
>>> +
>>>  } else if (streq(name, "MemoryLimit")) {
>>>  
>>>  if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_UINT64)
>>> diff --git a/src/core/load-fragment-gperf.gperf.m4 
>>> b/src/core/load-fragment-gperf.gperf.m4
>>> index 2

Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-23 Thread Gao feng
On 09/24/2013 05:06 AM, Lennart Poettering wrote:
> On Mon, 23.09.13 14:30, Gao feng (gaof...@cn.fujitsu.com) wrote:
> 
>> Some programs need to set the memory.use_hierarchy(such as libvirt),
>> Add this feature.
> 
> As mentioned already: this really shouldn't be configurable but simply
> the unconditional configuration that systemd requires. I have hence now
> commited a different patch that strictly enables this option at
> boot-time in the root memory hierarchy and does not turn this into yet
> another user config switch.

So administrator has no rights to set use_hierarchy to false?
This patchset enables use_hierarchy for unit by default. but give
users the rights to disable this.

> 
> THis is what Tejun suggested to do and is also what makes the most sense
> to me. cgroups after all are organized logically in a tree and it is
> simply contradictory ignore this all and pretend everything was flat...
> 
>> ---
>>  src/core/cgroup.c |  6 ++
>>  src/core/cgroup.h |  1 +
>>  src/core/dbus-cgroup.c| 16 
>>  src/core/load-fragment-gperf.gperf.m4 |  1 +
>>  4 files changed, 24 insertions(+)
>>
>> diff --git a/src/core/cgroup.c b/src/core/cgroup.c
>> index d10f205..68615c3 100644
>> --- a/src/core/cgroup.c
>> +++ b/src/core/cgroup.c
>> @@ -32,6 +32,7 @@ void cgroup_context_init(CGroupContext *c) {
>>  /* Initialize everything to the kernel defaults, assuming the
>>   * structure is preinitialized to 0 */
>>  
>> +c->memory_hierarchy = true;
>>  c->cpu_shares = 1024;
>>  c->memory_limit = (uint64_t) -1;
>>  c->blockio_weight = 1000;
>> @@ -263,6 +264,11 @@ void cgroup_context_apply(CGroupContext *c, 
>> CGroupControllerMask mask, const cha
>>  
>>  if (r < 0)
>>  log_error("Failed to set memory.limit_in_bytes on 
>> %s: %s", path, strerror(-r));
>> +
>> +r = cg_set_attribute("memory", path, 
>> "memory.use_hierarchy", c->memory_hierarchy ? "1" : "0");
>> +
>> +if (r < 0)
>> +log_error("Failed to set memory.use_hierarchy on 
>> %s: %s", path, strerror(-r));
>>  }
>>  
>>  if (mask & CGROUP_DEVICE) {
>> diff --git a/src/core/cgroup.h b/src/core/cgroup.h
>> index 0a079e9..f87c16a 100644
>> --- a/src/core/cgroup.h
>> +++ b/src/core/cgroup.h
>> @@ -69,6 +69,7 @@ struct CGroupContext {
>>  bool cpu_accounting;
>>  bool blockio_accounting;
>>  bool memory_accounting;
>> +bool memory_hierarchy;
>>  
>>  unsigned long cpu_shares;
>>  
>> diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
>> index 9ebcad9..a8a5f81 100644
>> --- a/src/core/dbus-cgroup.c
>> +++ b/src/core/dbus-cgroup.c
>> @@ -132,6 +132,7 @@ const BusProperty bus_cgroup_context_properties[] = {
>>  { "BlockIOReadBandwidth",bus_cgroup_append_device_bandwidths, 
>> "a(st)", 0   },
>>  { "BlockIOWriteBandwidth",   bus_cgroup_append_device_bandwidths, 
>> "a(st)", 0   },
>>  { "MemoryAccounting",bus_property_append_bool,
>> "b", offsetof(CGroupContext, memory_accounting)  },
>> +{ "MemoryHierarchy", bus_property_append_bool,
>> "b", offsetof(CGroupContext, memory_hierarchy)   },
>>  { "MemoryLimit", bus_property_append_uint64,  
>> "t", offsetof(CGroupContext, memory_limit)   },
>>  { "DevicePolicy",bus_cgroup_append_device_policy, 
>> "s", offsetof(CGroupContext, device_policy)  },
>>  { "DeviceAllow", bus_cgroup_append_device_allow,  
>> "a(ss)", 0   },
>> @@ -417,6 +418,21 @@ int bus_cgroup_set_property(
>>  
>>  return 1;
>>  
>> +} else if (streq(name, "MemoryHierarchy")) {
>> +
>> +if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_BOOLEAN)
>> +return -EINVAL;
>> +
>> +if (mode != UNIT_CHECK) {
>> +dbus_bool_t b;
>> +dbus_message_iter_get_basic(i, &b);
>> +
>> +c->memory_hierarchy = b;
>> +unit_write_drop_in_private(u, mode, name, b ? 
>> "MemoryHierarchy=yes" : "MemoryHierarchy=no");
>> +}
>> +
>> +return 1;
>> +
>>  } else if (streq(name, "MemoryLimit")) {
>>  
>>  if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_UINT64)
>> diff --git a/src/core/load-fragment-gperf.gperf.m4 
>> b/src/core/load-fragment-gperf.gperf.m4
>> index 25bd3aa..b43ca05 100644
>> --- a/src/core/load-fragment-gperf.gperf.m4
>> +++ b/src/core/load-fragment-gperf.gperf.m4
>> @@ -88,6 +88,7 @@ m4_define(`CGROUP_CONTEXT_CONFIG_ITEMS',
>>  $1.CPUAccounting,config_pars

Re: [systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-23 Thread Lennart Poettering
On Mon, 23.09.13 14:30, Gao feng (gaof...@cn.fujitsu.com) wrote:

> Some programs need to set the memory.use_hierarchy(such as libvirt),
> Add this feature.

As mentioned already: this really shouldn't be configurable but simply
the unconditional configuration that systemd requires. I have hence now
commited a different patch that strictly enables this option at
boot-time in the root memory hierarchy and does not turn this into yet
another user config switch.

THis is what Tejun suggested to do and is also what makes the most sense
to me. cgroups after all are organized logically in a tree and it is
simply contradictory ignore this all and pretend everything was flat...

> ---
>  src/core/cgroup.c |  6 ++
>  src/core/cgroup.h |  1 +
>  src/core/dbus-cgroup.c| 16 
>  src/core/load-fragment-gperf.gperf.m4 |  1 +
>  4 files changed, 24 insertions(+)
> 
> diff --git a/src/core/cgroup.c b/src/core/cgroup.c
> index d10f205..68615c3 100644
> --- a/src/core/cgroup.c
> +++ b/src/core/cgroup.c
> @@ -32,6 +32,7 @@ void cgroup_context_init(CGroupContext *c) {
>  /* Initialize everything to the kernel defaults, assuming the
>   * structure is preinitialized to 0 */
>  
> +c->memory_hierarchy = true;
>  c->cpu_shares = 1024;
>  c->memory_limit = (uint64_t) -1;
>  c->blockio_weight = 1000;
> @@ -263,6 +264,11 @@ void cgroup_context_apply(CGroupContext *c, 
> CGroupControllerMask mask, const cha
>  
>  if (r < 0)
>  log_error("Failed to set memory.limit_in_bytes on 
> %s: %s", path, strerror(-r));
> +
> +r = cg_set_attribute("memory", path, "memory.use_hierarchy", 
> c->memory_hierarchy ? "1" : "0");
> +
> +if (r < 0)
> +log_error("Failed to set memory.use_hierarchy on %s: 
> %s", path, strerror(-r));
>  }
>  
>  if (mask & CGROUP_DEVICE) {
> diff --git a/src/core/cgroup.h b/src/core/cgroup.h
> index 0a079e9..f87c16a 100644
> --- a/src/core/cgroup.h
> +++ b/src/core/cgroup.h
> @@ -69,6 +69,7 @@ struct CGroupContext {
>  bool cpu_accounting;
>  bool blockio_accounting;
>  bool memory_accounting;
> +bool memory_hierarchy;
>  
>  unsigned long cpu_shares;
>  
> diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
> index 9ebcad9..a8a5f81 100644
> --- a/src/core/dbus-cgroup.c
> +++ b/src/core/dbus-cgroup.c
> @@ -132,6 +132,7 @@ const BusProperty bus_cgroup_context_properties[] = {
>  { "BlockIOReadBandwidth",bus_cgroup_append_device_bandwidths, 
> "a(st)", 0   },
>  { "BlockIOWriteBandwidth",   bus_cgroup_append_device_bandwidths, 
> "a(st)", 0   },
>  { "MemoryAccounting",bus_property_append_bool,
> "b", offsetof(CGroupContext, memory_accounting)  },
> +{ "MemoryHierarchy", bus_property_append_bool,
> "b", offsetof(CGroupContext, memory_hierarchy)   },
>  { "MemoryLimit", bus_property_append_uint64,  
> "t", offsetof(CGroupContext, memory_limit)   },
>  { "DevicePolicy",bus_cgroup_append_device_policy, 
> "s", offsetof(CGroupContext, device_policy)  },
>  { "DeviceAllow", bus_cgroup_append_device_allow,  
> "a(ss)", 0   },
> @@ -417,6 +418,21 @@ int bus_cgroup_set_property(
>  
>  return 1;
>  
> +} else if (streq(name, "MemoryHierarchy")) {
> +
> +if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_BOOLEAN)
> +return -EINVAL;
> +
> +if (mode != UNIT_CHECK) {
> +dbus_bool_t b;
> +dbus_message_iter_get_basic(i, &b);
> +
> +c->memory_hierarchy = b;
> +unit_write_drop_in_private(u, mode, name, b ? 
> "MemoryHierarchy=yes" : "MemoryHierarchy=no");
> +}
> +
> +return 1;
> +
>  } else if (streq(name, "MemoryLimit")) {
>  
>  if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_UINT64)
> diff --git a/src/core/load-fragment-gperf.gperf.m4 
> b/src/core/load-fragment-gperf.gperf.m4
> index 25bd3aa..b43ca05 100644
> --- a/src/core/load-fragment-gperf.gperf.m4
> +++ b/src/core/load-fragment-gperf.gperf.m4
> @@ -88,6 +88,7 @@ m4_define(`CGROUP_CONTEXT_CONFIG_ITEMS',
>  $1.CPUAccounting,config_parse_bool,  0,  
>offsetof($1, cgroup_context.cpu_accounting)
>  $1.CPUShares,config_parse_cpu_shares,0,  
>offsetof($1, cgroup_context)
>  $1.MemoryAccounting, config_parse_bool,  0,  
> 

[systemd-devel] [PATCH v2 1/4] cgroup: add the setting memory.use_hierarchy support for systemd

2013-09-22 Thread Gao feng
Some programs need to set the memory.use_hierarchy(such as libvirt),
Add this feature.
---
 src/core/cgroup.c |  6 ++
 src/core/cgroup.h |  1 +
 src/core/dbus-cgroup.c| 16 
 src/core/load-fragment-gperf.gperf.m4 |  1 +
 4 files changed, 24 insertions(+)

diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index d10f205..68615c3 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -32,6 +32,7 @@ void cgroup_context_init(CGroupContext *c) {
 /* Initialize everything to the kernel defaults, assuming the
  * structure is preinitialized to 0 */
 
+c->memory_hierarchy = true;
 c->cpu_shares = 1024;
 c->memory_limit = (uint64_t) -1;
 c->blockio_weight = 1000;
@@ -263,6 +264,11 @@ void cgroup_context_apply(CGroupContext *c, 
CGroupControllerMask mask, const cha
 
 if (r < 0)
 log_error("Failed to set memory.limit_in_bytes on %s: 
%s", path, strerror(-r));
+
+r = cg_set_attribute("memory", path, "memory.use_hierarchy", 
c->memory_hierarchy ? "1" : "0");
+
+if (r < 0)
+log_error("Failed to set memory.use_hierarchy on %s: 
%s", path, strerror(-r));
 }
 
 if (mask & CGROUP_DEVICE) {
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index 0a079e9..f87c16a 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -69,6 +69,7 @@ struct CGroupContext {
 bool cpu_accounting;
 bool blockio_accounting;
 bool memory_accounting;
+bool memory_hierarchy;
 
 unsigned long cpu_shares;
 
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index 9ebcad9..a8a5f81 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -132,6 +132,7 @@ const BusProperty bus_cgroup_context_properties[] = {
 { "BlockIOReadBandwidth",bus_cgroup_append_device_bandwidths, 
"a(st)", 0   },
 { "BlockIOWriteBandwidth",   bus_cgroup_append_device_bandwidths, 
"a(st)", 0   },
 { "MemoryAccounting",bus_property_append_bool,"b", 
offsetof(CGroupContext, memory_accounting)  },
+{ "MemoryHierarchy", bus_property_append_bool,"b", 
offsetof(CGroupContext, memory_hierarchy)   },
 { "MemoryLimit", bus_property_append_uint64,  "t", 
offsetof(CGroupContext, memory_limit)   },
 { "DevicePolicy",bus_cgroup_append_device_policy, "s", 
offsetof(CGroupContext, device_policy)  },
 { "DeviceAllow", bus_cgroup_append_device_allow,  
"a(ss)", 0   },
@@ -417,6 +418,21 @@ int bus_cgroup_set_property(
 
 return 1;
 
+} else if (streq(name, "MemoryHierarchy")) {
+
+if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_BOOLEAN)
+return -EINVAL;
+
+if (mode != UNIT_CHECK) {
+dbus_bool_t b;
+dbus_message_iter_get_basic(i, &b);
+
+c->memory_hierarchy = b;
+unit_write_drop_in_private(u, mode, name, b ? 
"MemoryHierarchy=yes" : "MemoryHierarchy=no");
+}
+
+return 1;
+
 } else if (streq(name, "MemoryLimit")) {
 
 if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_UINT64)
diff --git a/src/core/load-fragment-gperf.gperf.m4 
b/src/core/load-fragment-gperf.gperf.m4
index 25bd3aa..b43ca05 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -88,6 +88,7 @@ m4_define(`CGROUP_CONTEXT_CONFIG_ITEMS',
 $1.CPUAccounting,config_parse_bool,  0,
 offsetof($1, cgroup_context.cpu_accounting)
 $1.CPUShares,config_parse_cpu_shares,0,
 offsetof($1, cgroup_context)
 $1.MemoryAccounting, config_parse_bool,  0,
 offsetof($1, cgroup_context.memory_accounting)
+$1.MemoryHierarchy,  config_parse_bool,  0,
 offsetof($1, cgroup_context.memory_hierarchy)
 $1.MemoryLimit,  config_parse_memory_limit,  0,
 offsetof($1, cgroup_context)
 $1.DeviceAllow,  config_parse_device_allow,  0,
 offsetof($1, cgroup_context)
 $1.DevicePolicy, config_parse_device_policy, 0,
 offsetof($1, cgroup_context.device_policy)
-- 
1.8.3.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel