Linux cgroups development
 help / color / mirror / Atom feed
* Getting notifications of the tasks file
@ 2012-07-31  9:42 Víctor Fernández Martínez
  2012-07-31 14:14 ` Kirill A. Shutemov
  2012-08-07 11:33 ` Zhu Yanhai
  0 siblings, 2 replies; 3+ messages in thread
From: Víctor Fernández Martínez @ 2012-07-31  9:42 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8-sig", Size: 2022 bytes --]

I'm trying to use the eventfd notification API to get notified when the tasks 
file changes. This way I would like to know when child processes are spawned 
and when they exit. However, I always get EINVAL when writing to 
cgroup.event_control. Even cgroup_event_listener.c returns that error:

# cat /sys/fs/cgroup/memory/grp0/tasks 
3590
23902
# ./cgroup_event_listener /sys/fs/cgroup/memory/grp0/tasks 0
Cannot write to cgroup.event_control: Invalid argument

I have also tried to monitor cgroup.procs.

Is it possible to monitor the tasks file at all or is this a bug? If 0 is a 
wrong argument, which argument should I use instead?


Thanks.


Barracuda Networks AG
Vorsitzender des Aufsichtsrates/ Chairman of the supervisory board: Dean Drako
Vorstand/ Executive Board: Dr. Wieland Alge, Mag. Guenter Klausner
Sitz der Gesellschaft/ Registered office: 6020 Innsbruck, Austria
Handelsgericht Innsbruck Firmenbuch/ Registration Number: 184392s
UID-Nr/ VAT Number: ATU47509003

Diese Nachricht und allfaellige angehaengte Dokumente sind vertraulich und nur fuer den/die Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat sein, ist jede Offenlegung, Weiterleitung oder sonstige Verwendung dieser Information nicht gestattet. In diesem Fall bitten wir, den Absender zu verstaendigen und die Information zu vernichten. Fuer Uebermittlungsfehler oder sonstige Irrtuemer bei Uebermittlung besteht keine Haftung.

This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the material. The sender does not accept liability for any errors or omissions as a result of the transmission.


'Like' us on Facebook for exclusive content and other resources on all Barracuda Networks solutions.
Visit http://barracudanetworks.com/facebook


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting notifications of the tasks file
  2012-07-31  9:42 Getting notifications of the tasks file Víctor Fernández Martínez
@ 2012-07-31 14:14 ` Kirill A. Shutemov
  2012-08-07 11:33 ` Zhu Yanhai
  1 sibling, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2012-07-31 14:14 UTC (permalink / raw)
  To: Víctor Fernández Martínez; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

On Tue, Jul 31, 2012 at 11:42:06AM +0200, Víctor Fernández Martínez wrote:
> I'm trying to use the eventfd notification API to get notified when the tasks 
> file changes. This way I would like to know when child processes are spawned 
> and when they exit. However, I always get EINVAL when writing to 
> cgroup.event_control. Even cgroup_event_listener.c returns that error:
> 
> # cat /sys/fs/cgroup/memory/grp0/tasks 
> 3590
> 23902
> # ./cgroup_event_listener /sys/fs/cgroup/memory/grp0/tasks 0
> Cannot write to cgroup.event_control: Invalid argument
> 
> I have also tried to monitor cgroup.procs.
> 
> Is it possible to monitor the tasks file at all or is this a bug? If 0 is a 
> wrong argument, which argument should I use instead?

Currently, you can only listen for events from memory.usage_in_bytes,
memory.memsw.usage_in_bytes and memory.oom_control.
It's not implemented for any other cgroup files yet.

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting notifications of the tasks file
  2012-07-31  9:42 Getting notifications of the tasks file Víctor Fernández Martínez
  2012-07-31 14:14 ` Kirill A. Shutemov
@ 2012-08-07 11:33 ` Zhu Yanhai
  1 sibling, 0 replies; 3+ messages in thread
From: Zhu Yanhai @ 2012-08-07 11:33 UTC (permalink / raw)
  To: Víctor Fernández Martínez; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

Did you try inotify() ?

-zyh

2012/7/31 Víctor Fernández Martínez <vfernandez@barracuda.com>:
> I'm trying to use the eventfd notification API to get notified when the tasks
> file changes. This way I would like to know when child processes are spawned
> and when they exit. However, I always get EINVAL when writing to
> cgroup.event_control. Even cgroup_event_listener.c returns that error:
>
> # cat /sys/fs/cgroup/memory/grp0/tasks
> 3590
> 23902
> # ./cgroup_event_listener /sys/fs/cgroup/memory/grp0/tasks 0
> Cannot write to cgroup.event_control: Invalid argument
>
> I have also tried to monitor cgroup.procs.
>
> Is it possible to monitor the tasks file at all or is this a bug? If 0 is a
> wrong argument, which argument should I use instead?
>
>
> Thanks.
>
>
> Barracuda Networks AG
> Vorsitzender des Aufsichtsrates/ Chairman of the supervisory board: Dean Drako
> Vorstand/ Executive Board: Dr. Wieland Alge, Mag. Guenter Klausner
> Sitz der Gesellschaft/ Registered office: 6020 Innsbruck, Austria
> Handelsgericht Innsbruck Firmenbuch/ Registration Number: 184392s
> UID-Nr/ VAT Number: ATU47509003
>
> Diese Nachricht und allfaellige angehaengte Dokumente sind vertraulich und nur fuer den/die Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat sein, ist jede Offenlegung, Weiterleitung oder sonstige Verwendung dieser Information nicht gestattet. In diesem Fall bitten wir, den Absender zu verstaendigen und die Information zu vernichten. Fuer Uebermittlungsfehler oder sonstige Irrtuemer bei Uebermittlung besteht keine Haftung.
>
> This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the material. The sender does not accept liability for any errors or omissions as a result of the transmission.
>
>
> 'Like' us on Facebook for exclusive content and other resources on all Barracuda Networks solutions.
> Visit http://barracudanetworks.com/facebook
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe cgroups" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-07 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-31  9:42 Getting notifications of the tasks file Víctor Fernández Martínez
2012-07-31 14:14 ` Kirill A. Shutemov
2012-08-07 11:33 ` Zhu Yanhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox