[systemd-devel] [PATCH 1/3] Enable systemd to set/show limit of memory+Swap usage

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Tue Sep 17 19:23:40 PDT 2013



> -----Original Message-----
> From: Lennart Poettering [mailto:lennart at poettering.net]
> Sent: Wednesday, September 18, 2013 12:54 AM
> To: Chen Hanxiao
> Cc: systemd-devel at lists.freedesktop.org
> Subject: Re: [systemd-devel] [PATCH 1/3] Enable systemd to set/show limit
of
> memory+Swap usage
> 
> On Tue, 17.09.13 17:36, Lennart Poettering (lennart at poettering.net) wrote:
> 
> > On Tue, 17.09.13 14:21, Chen Hanxiao (chenhanxiao at cn.fujitsu.com) wrote:
> >
> > > From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > >
> > > @@ -89,6 +89,7 @@ $1.CPUAccounting,
> config_parse_bool,                  0,
> > >  $1.CPUShares,                    config_parse_cpu_shares,
> 0,                             offsetof($1, cgroup_context)
> > >  $1.MemoryAccounting,             config_parse_bool,
> 0,                             offsetof($1,
> cgroup_context.memory_accounting)
> > >  $1.MemoryLimit,                  config_parse_memory_limit,
> 0,                             offsetof($1, cgroup_context)
> > > +$1.MemorySWLimit,                config_parse_memory_limit,
> 0,                             offsetof($1, cgroup_context)
> > >  $1.MemorySoftLimit,              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)
> >
> > OK, so here's another idea: I have the strong suspicion that people are
> > much more likely using the new limit that includes the swap than the
> > current MemoryLimit= that doesn't.
> >
> > Hence, to make this simpler, I'd propose to simply swap things around:
> >
> > MemoryLimit= would start writing to memory.memsw.limit_in_bytes. And a
> > new MemoryRAMLimit= would controler the original memory.limit_in_bytes?
> >
> > This shifts things around a bit but I think it would be much nicer to
> > use?
> 
> OK, so I talked to Tejun here at LinuxCon and he said that we probably
> should not expose memory.memsw.limit_in_bytes for now since it's likely
> to change or go away soon. In fact, the only memory attribute we should
> expose for now is MemoryLimit= accorrding to him, and it should do what
> it already does.
> 
> Also, he said that memory.use_hierarchy should be unconditionally set by
> systemd for all cgroups systemd creates.
> 
> Lennart

Got it.  
Then let's see how cgroup would deal with it.

Thanks.

> 
> --
> Lennart Poettering - Red Hat, Inc.




More information about the systemd-devel mailing list