I've got it! That's what will work: struct task_struct { ... struct beancounter *exec_bc; struct beancounter *tmp_exec_bc; /* is set to NULL on * tsk creation */ };
struct beancounter get_exec_bc(void) { if (current->tmp_exec_bc) return current->tmp_exec_bc; return rcu_dereference(current->exec_bc); } struct beancounter set_tmp_exec_bc(struct beancounter *new) { struct beancounter *old; old = current->tmp_exec_bc; current->tmp_exec_bc = new; return old; } void reset_tmp_exec_bc(struct beancounter *expected_old) { BUG_ON(current->tmp_exec_bc != expected_old); current->tmp_exec_bc = NULL; } void move_task(struct task_struct *tsk, struct beancounter *bc) { struct beancounter *old; mutex_lock(&tsk_move_mutex); old = tsk->exec_bc; get_bc(bc); rcu_assign_pointer(current->exec_bc, bc); syncronize_rcu(); mutex_unlock(&tsk_move_mutex); bc_put(old); } I will implement this in the next beancounter patches. Thanks for discussion :) ------------------------------------------------------------------------- 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