On Fri, Jul 1, 2011 at 2:02 PM, Kevin Constantine
<kevin.constant...@disneyanimation.com> wrote:
> I'm seeing an issue with cgroup_modify_cgroup() and read-only values
> parameters.  The code below should be run twice to demonstrate the
> issue.  The first time through, cgroup_get_cgroup fails because the
> cgroup doesn't exist yet.  It then creates a cgroup /asdf with the
> memory and the cpuset controllers.  It sets memory.limit_in_bytes to 2G.
>  That all works as expected.
>
> The second time you run it, cgroup_get_cgroup succeeds and we go try to
> modify memory.limit_in_bytes to be 4G.  cgroup_modify_cgroup() always
> seems to fail trying to write "0" to
> /cgroup/cpuset/asdf/cpuset.memory_pressure (a read-only parameter).
>
> Here's a snippet of the failing strace:
>
> munmap(0x7f168191a000, 4096)            = 0 <0.000015>
> open("/cgroup/cpuset//asdf/cpuset.memory_pressure", O_RDWR) = 3 <0.000018>
> fstat(3, {st_mode=S_IFREG|0775, st_size=0, ...}) = 0 <0.000011>
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> = 0x7f168191a000 <0.000012>
> write(3, "0", 1)                        = -1 EACCES (Permission denied)
> <0.000012>
> close(3)                                = 0 <0.000011>
> munmap(0x7f168191a000, 4096)            = 0 <0.000015>
> write(1, "Modify Error:  Cgroup operation "..., 39Modify Error:  Cgroup
> operation failed
> ) = 39 <0.000015>
> exit_group(0)                           = ?
>
> It looks like when cgroup_modify_cgroup() encounters an error, it
> immediately stops and returns an error which is why
> memory.limit_in_bytes never gets set to 4G the second time through.  Any
> suggestions on what to do in this situation?
>

Ah, read-only stuff. Yes, I think the right answer might be to ignore
the failure due to non-permissions, but let me think of a more
graceful method. I don't have the code handy with me right now, so
once I get home, I will take a look and try to send something.

Dhaval

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to