workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
Subsystems (3)
PATCH 1/3 workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
In case CONFIG_DEBUG_OBJECTS_WORK is defined, it is needed to call destroy_work_on_stack() which frees the debug object to pair with INIT_WORK_ONSTACK().
--- kernel/workqueue.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/workqueue.c +2 -0
@@ -4789,6 +4789,7 @@ static int workqueue_cpu_down_callback(struct notifier_block *nfb,/* wait for per-cpu unbinding to finish */ flush_work (&unbind_work); +destroy_work_on_stack (&unbind_work);break ; }return NOTIFY_OK ;
@@ -4828,6 +4829,7 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg)INIT_WORK_ONSTACK (&wfc.work, work_for_cpu_fn);schedule_work_on (cpu, &wfc.work);flush_work (&wfc.work); +destroy_work_on_stack (&wfc.work);return wfc.ret; }EXPORT_SYMBOL_GPL (work_on_cpu);
Signature · 1 line
1.7.9.5
PATCH 2/3 xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
In case CONFIG_DEBUG_OBJECTS_WORK is defined, it is needed to call destroy_work_on_stack() which frees the debug object to pair with INIT_WORK_ONSTACK().
--- fs/xfs/xfs_bmap_util.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/xfs_bmap_util.c +1 -0
@@ -287,6 +287,7 @@ xfs_bmapi_allocate(INIT_WORK_ONSTACK (&args->work, xfs_bmapi_allocate_worker);queue_work (xfs_alloc_wq, &args->work);wait_for_completion (&done); +destroy_work_on_stack (&args->work);return args->result; }
Signature · 1 line
1.7.9.5
Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
Hi Chuansheng,
Quoted 15 lines · Chuansheng Liu
In case
CONFIG_DEBUG_OBJECTS_WORKis defined, it is needed to calldestroy_work_on_stack()which frees the debug object to pair withINIT_WORK_ONSTACK().Signed-off-by Liu, Chuansheng <[email protected]>--- fs/xfs/xfs_bmap_util.c | 1 + 1 file changed, 1 insertion(+)fs/xfs/xfs_bmap_util.c +0
-0
fs/xfs/xfs_bmap_util.c xfs_bmapi_allocate( · line 292
Quoted 6 lines
fs/xfs/xfs_bmap_util.c +1
-0@@ -287,6 +287,7 @@ xfs_bmapi_allocate(INIT_WORK_ONSTACK (&args->work, xfs_bmapi_allocate_worker);queue_work (xfs_alloc_wq, &args->work);wait_for_completion (&done); +destroy_work_on_stack (&args->work);return args->result; }
Thanks for your patch and it work fine for my testing. I missed this in an old commit: [ 3b876c8f2a xfs: fix debug_object WARN at xfs_alloc_vextent() ]
Just out of curious, do you notice memory leaks or other hints which help you finding out this problem?
Thanks,
-Jeff
Ben Myers
Reviewed-byRe: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
Quoted 13 lines · Jeff Liu
Hi Chuansheng,
Quoted 10 lines · Chuansheng Liu
In case
CONFIG_DEBUG_OBJECTS_WORKis defined, it is needed to calldestroy_work_on_stack()which frees the debug object to pair withINIT_WORK_ONSTACK().Signed-off-by Liu, Chuansheng <[email protected]>--- fs/xfs/xfs_bmap_util.c | 1 + 1 file changed, 1 insertion(+)
Quoted 14 lines
fs/xfs/xfs_bmap_util.c xfs_bmapi_allocate( · line 292
Quoted 11 lines
fs/xfs/xfs_bmap_util.c +1
-0@@ -287,6 +287,7 @@ xfs_bmapi_allocate(INIT_WORK_ONSTACK (&args->work, xfs_bmapi_allocate_worker);queue_work (xfs_alloc_wq, &args->work);wait_for_completion (&done); +destroy_work_on_stack (&args->work);return args->result; }Thanks for your patch and it work fine for my testing. I missed this in an old commit: [
3b876c8f2axfs: fixdebug_objectWARN atxfs_alloc_vextent()]
Looks good to me too.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
RE: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
In reply to Jeff LiuHello Jeff,
Quoted 12 lines
-----Original Message-----
From: Jeff Liu [mailto:[email protected]]
Sent: Tuesday, January 07, 2014 7:21 PM
To: Liu, Chuansheng; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 2/3] xfs: Callingdestroy_work_on_stack()to pair withINIT_WORK_ONSTACK()Hi Chuansheng,
Quoted 1 line · Chuansheng Liu
Quoted 8 lines
Quoted 6 lines
In case
CONFIG_DEBUG_OBJECTS_WORKis defined, it is needed to calldestroy_work_on_stack()which frees the debug object to pair withINIT_WORK_ONSTACK().Signed-off-by Liu, Chuansheng <[email protected]>---
Thanks for your patch and it work fine for my testing. I missed this in an old commit: [
3b876c8f2axfs: fixdebug_objectWARN atxfs_alloc_vextent()]
Thanks your testing.
Quoted 3 lines
Just out of curious, do you notice memory leaks or other hints which help you finding out this problem?
I am trying to use the INIT_WORK_ONSTACK() in my code, then I found in some places Calling destroy_work_on_stack() is missed.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/3 dm snapshot: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
In reply to Chuansheng LiuIn case CONFIG_DEBUG_OBJECTS_WORK is defined, it is needed to call destroy_work_on_stack() which frees the debug object to pair with INIT_WORK_ONSTACK().
--- drivers/md/dm-snap-persistent.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-snap-persistent.c +1 -0
@@ -257,6 +257,7 @@ static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw,INIT_WORK_ONSTACK (&req.work, do_metadata);queue_work (ps->metadata_wq, &req.work);flush_workqueue (ps->metadata_wq); +destroy_work_on_stack (&req.work);return req.result; }
Signature · 1 line
1.7.9.5
Mike Snitzer
AppliedRe: [PATCH 3/3] dm snapshot: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
Quoted 6 lines · Chuansheng Liu
In case
CONFIG_DEBUG_OBJECTS_WORKis defined, it is needed to calldestroy_work_on_stack()which frees the debug object to pair withINIT_WORK_ONSTACK().Signed-off-by Liu, Chuansheng <[email protected]>
Applied to linux-dm.git's 'for-next' branch.
Thanks,
Mike
Quoted 6 lines · Chuansheng Liu
In case
CONFIG_DEBUG_OBJECTS_WORKis defined, it is needed to calldestroy_work_on_stack()which frees the debug object to pair withINIT_WORK_ONSTACK().Signed-off-by Liu, Chuansheng <[email protected]>
Applied to wq/for-3.14. Thanks.
Signature · 1 line
tejun