What's the recommended safe way to access current->res_group (or even an arbitrary task->res_group) without racing against a concurrent set_res_group() call from a different process?
For example, when calling numtasks_allow_fork(current->res_group) in numtasks, I don't see anything that guarantees that current will remain in the same res_group, or even that the res_group will persist for the lifetime of the call. (OK, so numtasks_allow_fork() isn't exactly a very long function call, but it's the principle that counts ...) How about using task->alloc_lock to protect task->res_group? So all manipulation would either have to be done inside task->alloc_lock, or else would need to use a function such as: struct resource_group *task_get_res_group(struct task_struct *task) { struct resource_group *res; lock_task(task); res = task->res_group; if (res) kref_get(&res->ref); unlock_task(task); return res; } An alternative (more efficient but more complex) approach would be to use RCU. Paul ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ ckrm-tech mailing list https://lists.sourceforge.net/lists/listinfo/ckrm-tech