Skip to contentSkip to conversation

Getting notifications of the tasks file

DISCUSSION Víctor Fernández Martínez 3 participants 3 messages Jul 31, 2012 – Aug 7, 2012 cgroup

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 11 lines · Víctor Fernández Martínez

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
Quoted 4 lines

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.

Signature · 1 line
 Kirill A. Shutemov
#2 lore raw
In reply to Víctor Fernández Martínez

Did you try inotify() ?

-zyh

2012/7/31 Víctor Fernández Martínez <[email protected]>:

Quoted 40 lines

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html