On Mon, Apr 02, 2012 at 08:22:14AM +0400, Alexander Nikiforov wrote: I think it should be part of task counter css, not core. CC list updated. > @@ -4558,6 +4594,22 @@ void cgroup_fork(struct task_struct *child) > child->cgroups = current->cgroups; > get_css_set(child->cgroups); > INIT_LIST_HEAD(&child->cg_list); > + > + struct cgroupfs_root *root; > + > + /* send event to the userspace */ > + mutex_lock(&cgroup_mutex); > + for_each_active_root(root) { > + struct cgroup *cgrp; > + struct fe_eventfd_list *ev; > + > + cgrp = task_cgroup_from_root(child, root); > + > + list_for_each_entry(ev, &cgrp->fe_notify, list) { > + eventfd_signal(ev->eventfd, 1); > + } > + } > + mutex_unlock(&cgroup_mutex); > } How does it affect performance? > > /** > @@ -4653,6 +4705,7 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks) > { > struct css_set *cg; > int i; > + struct cgroupfs_root *root; > > /* > * Unlink from the css_set task list if necessary. > @@ -4666,6 +4719,20 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks) > write_unlock(&css_set_lock); > } > > + /* send event to the userspace */ > + mutex_lock(&cgroup_mutex); > + for_each_active_root(root) { > + struct cgroup *cgrp; > + struct fe_eventfd_list *ev; > + > + cgrp = task_cgroup_from_root(tsk, root); > + > + list_for_each_entry(ev, &cgrp->fe_notify, list) { > + eventfd_signal(ev->eventfd, 1); > + } > + } > + mutex_unlock(&cgroup_mutex); > + I think it's racy. You need to notify userspace after reassigning the task, not before. > /* Reassign the task to the init_css_set. */ > task_lock(tsk); > cg = tsk->cgroups; -- Kirill A. Shutemov -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html