event about group change
Hello, guys,
During our work we face to problem - get events about processes die in user space (not all but some of them). In the past we had special module which solve this problem.
But now I think that this task is quite native for cgroups subsystem. Move interesting PIDs into special group and set event handler. We investigate how events made in the memcg and implement proof of concepts patch against mainline (maybe little bit old, but it's just RFC message) with the same approach to "tasks" file.
So, I see several possible use cases for others with this patch.
1) replace wait4() for processes where we dont need for return status as well as we want just know about changing status of some group of processes
2) As extension of 1, implementing some balancing mechanism in the user space between several groups. For example if some process in one group consume much system resources, processes in other groups will be protected from slowdown.
3) Extremely useful in the libcgroup (in my mind), because now it's unprotected against changing state with hands.
Need you opinion about this.
Thank you.
A message that is not in the archive (sent off-list or not yet received): [email protected]
include/linux/cgroup.h +9 -0
@@ -192,6 +192,11 @@ struct cgroup_pidlist {struct rw_semaphore mutex; }; +struct fe_eventfd_list { +struct list_head list; +struct eventfd_ctx *eventfd; +}; +struct cgroup {unsigned long flags;/* "unsigned long" so bitops work */
@@ -243,6 +248,10 @@ struct cgroup {/* List of events which userspace want to receive */ struct list_head event_list;spinlock_t event_list_lock; + +/* fork-exit event */ +struct list_head fe_notify; +spinlock_t fe_list_lock; };/*
kernel/cgroup.c +67 -0
103 lines not on this page · raw message