Re: May the worker function free its struct_work (plus container)?

From: Yong Zhang
Date: Mon May 10 2010 - 21:28:09 EST


On Mon, May 10, 2010 at 12:18:38PM +0200, Leon Woestenberg wrote:
> Thanks. Is there API documentation or source code documentation that
> confirms this is the case?

static void run_workqueue(struct cpu_workqueue_struct *cwq)
{
....

#ifdef CONFIG_LOCKDEP
/*
* It is permissible to free the struct work_struct
* from inside the function that is called from it,
* this we need to take into account for lockdep too.
* To avoid bogus "held lock freed" warnings as well
* as problems when looking into work->lockdep_map,
* make a copy and use that here.
*/
struct lockdep_map lockdep_map = work->lockdep_map;
#endif
....
}

I think the above comments in run_workqueue() can reflect that
from a certain point.

Thanks,
Yong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/