All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
@ 2014-01-07  8:50 Chuansheng Liu
  2014-01-07  8:53   ` Chuansheng Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Chuansheng Liu @ 2014-01-07  8:50 UTC (permalink / raw)
  To: tj; +Cc: linux-kernel, chuansheng.liu


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().

Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
 kernel/workqueue.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index b010eac..82ef9f3 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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);
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07  8:50 [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() Chuansheng Liu
@ 2014-01-07  8:53   ` Chuansheng Liu
  2014-01-07  8:56 ` [PATCH 3/3] dm snapshot: " Chuansheng Liu
  2014-01-12  3:27 ` [PATCH 1/3] workqueue: " Tejun Heo
  2 siblings, 0 replies; 12+ messages in thread
From: Chuansheng Liu @ 2014-01-07  8:53 UTC (permalink / raw)
  To: dchinner, bpm; +Cc: xfs, linux-kernel, chuansheng.liu


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().

Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
 fs/xfs/xfs_bmap_util.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 1394106..82e0dab 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -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;
 }
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
@ 2014-01-07  8:53   ` Chuansheng Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Chuansheng Liu @ 2014-01-07  8:53 UTC (permalink / raw)
  To: dchinner, bpm; +Cc: chuansheng.liu, linux-kernel, xfs


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().

Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
 fs/xfs/xfs_bmap_util.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 1394106..82e0dab 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -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;
 }
 
-- 
1.7.9.5



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] dm snapshot: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07  8:50 [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() Chuansheng Liu
  2014-01-07  8:53   ` Chuansheng Liu
@ 2014-01-07  8:56 ` Chuansheng Liu
  2014-01-07 15:44   ` Mike Snitzer
  2014-01-12  3:27 ` [PATCH 1/3] workqueue: " Tejun Heo
  2 siblings, 1 reply; 12+ messages in thread
From: Chuansheng Liu @ 2014-01-07  8:56 UTC (permalink / raw)
  To: agk, snitzer; +Cc: linux-kernel, chuansheng.liu


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().

Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
---
 drivers/md/dm-snap-persistent.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 2d2b1b7..2f5a9f8 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -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;
 }
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07  8:53   ` Chuansheng Liu
@ 2014-01-07 11:21     ` Jeff Liu
  -1 siblings, 0 replies; 12+ messages in thread
From: Jeff Liu @ 2014-01-07 11:21 UTC (permalink / raw)
  To: Chuansheng Liu, dchinner, bpm; +Cc: linux-kernel, xfs

Hi Chuansheng,

On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> 
> 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().
> 
> Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> ---
>  fs/xfs/xfs_bmap_util.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 1394106..82e0dab 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
@ 2014-01-07 11:21     ` Jeff Liu
  0 siblings, 0 replies; 12+ messages in thread
From: Jeff Liu @ 2014-01-07 11:21 UTC (permalink / raw)
  To: Chuansheng Liu, dchinner, bpm; +Cc: linux-kernel, xfs

Hi Chuansheng,

On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> 
> 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().
> 
> Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> ---
>  fs/xfs/xfs_bmap_util.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 1394106..82e0dab 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] dm snapshot: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07  8:56 ` [PATCH 3/3] dm snapshot: " Chuansheng Liu
@ 2014-01-07 15:44   ` Mike Snitzer
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Snitzer @ 2014-01-07 15:44 UTC (permalink / raw)
  To: Chuansheng Liu; +Cc: agk, linux-kernel

On Tue, Jan 07 2014 at  3:56am -0500,
Chuansheng Liu <chuansheng.liu@intel.com> wrote:

> 
> 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().
> 
> Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>

Applied to linux-dm.git's 'for-next' branch.

Thanks,
Mike

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07 11:21     ` Jeff Liu
@ 2014-01-07 19:34       ` Ben Myers
  -1 siblings, 0 replies; 12+ messages in thread
From: Ben Myers @ 2014-01-07 19:34 UTC (permalink / raw)
  To: Jeff Liu, Chuansheng Liu; +Cc: dchinner, linux-kernel, xfs

On Tue, Jan 07, 2014 at 07:21:05PM +0800, Jeff Liu wrote:
> Hi Chuansheng,
> 
> On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> > 
> > 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().
> > 
> > Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> > ---
> >  fs/xfs/xfs_bmap_util.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> > index 1394106..82e0dab 100644
> > --- a/fs/xfs/xfs_bmap_util.c
> > +++ b/fs/xfs/xfs_bmap_util.c
> > @@ -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() ] 

Looks good to me too.
Reviewed-by: Ben Myers <bpm@sgi.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
@ 2014-01-07 19:34       ` Ben Myers
  0 siblings, 0 replies; 12+ messages in thread
From: Ben Myers @ 2014-01-07 19:34 UTC (permalink / raw)
  To: Jeff Liu, Chuansheng Liu; +Cc: dchinner, linux-kernel, xfs

On Tue, Jan 07, 2014 at 07:21:05PM +0800, Jeff Liu wrote:
> Hi Chuansheng,
> 
> On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> > 
> > 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().
> > 
> > Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> > ---
> >  fs/xfs/xfs_bmap_util.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> > index 1394106..82e0dab 100644
> > --- a/fs/xfs/xfs_bmap_util.c
> > +++ b/fs/xfs/xfs_bmap_util.c
> > @@ -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() ] 

Looks good to me too.
Reviewed-by: Ben Myers <bpm@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07 11:21     ` Jeff Liu
@ 2014-01-08  0:57       ` Liu, Chuansheng
  -1 siblings, 0 replies; 12+ messages in thread
From: Liu, Chuansheng @ 2014-01-08  0:57 UTC (permalink / raw)
  To: Jeff Liu, dchinner, bpm; +Cc: linux-kernel, xfs

Hello Jeff,

> -----Original Message-----
> From: Jeff Liu [mailto:jeff.liu@oracle.com]
> Sent: Tuesday, January 07, 2014 7:21 PM
> To: Liu, Chuansheng; dchinner@fromorbit.com; bpm@sgi.com
> Cc: linux-kernel@vger.kernel.org; xfs@oss.sgi.com
> Subject: Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with
> INIT_WORK_ONSTACK()
> 
> Hi Chuansheng,
> 
> On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> >
> > 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().
> >
> > Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> > ---
> 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() ]
Thanks your testing.

> 
> 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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
@ 2014-01-08  0:57       ` Liu, Chuansheng
  0 siblings, 0 replies; 12+ messages in thread
From: Liu, Chuansheng @ 2014-01-08  0:57 UTC (permalink / raw)
  To: Jeff Liu, dchinner, bpm; +Cc: linux-kernel, xfs

Hello Jeff,

> -----Original Message-----
> From: Jeff Liu [mailto:jeff.liu@oracle.com]
> Sent: Tuesday, January 07, 2014 7:21 PM
> To: Liu, Chuansheng; dchinner@fromorbit.com; bpm@sgi.com
> Cc: linux-kernel@vger.kernel.org; xfs@oss.sgi.com
> Subject: Re: [PATCH 2/3] xfs: Calling destroy_work_on_stack() to pair with
> INIT_WORK_ONSTACK()
> 
> Hi Chuansheng,
> 
> On 01/07 2014 16:53 PM, Chuansheng Liu wrote:
> >
> > 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().
> >
> > Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
> > ---
> 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() ]
Thanks your testing.

> 
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
  2014-01-07  8:50 [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() Chuansheng Liu
  2014-01-07  8:53   ` Chuansheng Liu
  2014-01-07  8:56 ` [PATCH 3/3] dm snapshot: " Chuansheng Liu
@ 2014-01-12  3:27 ` Tejun Heo
  2 siblings, 0 replies; 12+ messages in thread
From: Tejun Heo @ 2014-01-12  3:27 UTC (permalink / raw)
  To: Chuansheng Liu; +Cc: linux-kernel

On Tue, Jan 07, 2014 at 04:50:05PM +0800, Chuansheng Liu wrote:
> 
> 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().
> 
> Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>

Applied to wq/for-3.14.  Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-01-12  3:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-07  8:50 [PATCH 1/3] workqueue: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() Chuansheng Liu
2014-01-07  8:53 ` [PATCH 2/3] xfs: " Chuansheng Liu
2014-01-07  8:53   ` Chuansheng Liu
2014-01-07 11:21   ` Jeff Liu
2014-01-07 11:21     ` Jeff Liu
2014-01-07 19:34     ` Ben Myers
2014-01-07 19:34       ` Ben Myers
2014-01-08  0:57     ` Liu, Chuansheng
2014-01-08  0:57       ` Liu, Chuansheng
2014-01-07  8:56 ` [PATCH 3/3] dm snapshot: " Chuansheng Liu
2014-01-07 15:44   ` Mike Snitzer
2014-01-12  3:27 ` [PATCH 1/3] workqueue: " Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.