Re: [PATCH] smp: smp_call_on_cpu(): use INIT_WORK_ONSTACK() for automatic work_struct
From: Peter Zijlstra
Date: Fri Sep 23 2016 - 03:21:37 EST
On Thu, Sep 22, 2016 at 09:15:52PM +0200, Nicolai Stange wrote:
> One minor question regarding your patch though: it hasn't got a
> destroy_work_on_stack(). Isn't one needed because of
> INIT_WORK_ONSTACK() -> __INIT_WORK() -> __init_work() ->
> debug_object_init_on_stack() ?
> At least work_on_cpu() destroys its local work_struct that way...
I wasn't aware of destroy_work_on_stack(), and I'm not familiar enough
with the debug objects stuff to see hwo important it is to call.
Also, there's more INIT_WORK_ONSTACK usage lacking
destroy_work_on_stack() calls.
Maybe it would be good to do a patch fixing them all up and adding a
comment with INIT_WORK_ONSTACK() that says it ought to be paired with
destroy_work_on_stack().