* [PATCH] bdi: fix cleanup when fail to percpu_counter_init
@ 2017-09-15 18:27 weiping zhang
2017-09-18 8:35 ` Jan Kara
2017-09-18 14:04 ` Jens Axboe
0 siblings, 2 replies; 5+ messages in thread
From: weiping zhang @ 2017-09-15 18:27 UTC (permalink / raw)
To: axboe, jack, tj; +Cc: linux-mm
when percpu_counter_init fail at i, 0 ~ (i-1) should be destoried, not
1 ~ i.
Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
mm/backing-dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index e19606b..d399d3c 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -334,7 +334,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,
return 0;
out_destroy_stat:
- while (i--)
+ while (--i >= 0)
percpu_counter_destroy(&wb->stat[i]);
fprop_local_destroy_percpu(&wb->completions);
out_put_cong:
--
2.9.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] bdi: fix cleanup when fail to percpu_counter_init
2017-09-15 18:27 [PATCH] bdi: fix cleanup when fail to percpu_counter_init weiping zhang
@ 2017-09-18 8:35 ` Jan Kara
2017-09-18 14:04 ` Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Jan Kara @ 2017-09-18 8:35 UTC (permalink / raw)
To: weiping zhang; +Cc: axboe, jack, tj, linux-mm
On Sat 16-09-17 02:27:05, weiping zhang wrote:
> when percpu_counter_init fail at i, 0 ~ (i-1) should be destoried, not
> 1 ~ i.
>
> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Good catch. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/backing-dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index e19606b..d399d3c 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -334,7 +334,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,
> return 0;
>
> out_destroy_stat:
> - while (i--)
> + while (--i >= 0)
> percpu_counter_destroy(&wb->stat[i]);
> fprop_local_destroy_percpu(&wb->completions);
> out_put_cong:
> --
> 2.9.4
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bdi: fix cleanup when fail to percpu_counter_init
2017-09-15 18:27 [PATCH] bdi: fix cleanup when fail to percpu_counter_init weiping zhang
2017-09-18 8:35 ` Jan Kara
@ 2017-09-18 14:04 ` Jens Axboe
2017-09-19 8:13 ` Jan Kara
1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2017-09-18 14:04 UTC (permalink / raw)
To: weiping zhang, jack, tj; +Cc: linux-mm
On 09/15/2017 12:27 PM, weiping zhang wrote:
> when percpu_counter_init fail at i, 0 ~ (i-1) should be destoried, not
> 1 ~ i.
>
> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
> ---
> mm/backing-dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index e19606b..d399d3c 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -334,7 +334,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,
> return 0;
>
> out_destroy_stat:
> - while (i--)
> + while (--i >= 0)
These two constructs will produce identical results.
--
Jens Axboe
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bdi: fix cleanup when fail to percpu_counter_init
2017-09-18 14:04 ` Jens Axboe
@ 2017-09-19 8:13 ` Jan Kara
2017-09-19 10:31 ` weiping zhang
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2017-09-19 8:13 UTC (permalink / raw)
To: Jens Axboe; +Cc: weiping zhang, jack, tj, linux-mm
On Mon 18-09-17 08:04:04, Jens Axboe wrote:
> On 09/15/2017 12:27 PM, weiping zhang wrote:
> > when percpu_counter_init fail at i, 0 ~ (i-1) should be destoried, not
> > 1 ~ i.
> >
> > Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
> > ---
> > mm/backing-dev.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> > index e19606b..d399d3c 100644
> > --- a/mm/backing-dev.c
> > +++ b/mm/backing-dev.c
> > @@ -334,7 +334,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,
> > return 0;
> >
> > out_destroy_stat:
> > - while (i--)
> > + while (--i >= 0)
>
> These two constructs will produce identical results.
Bah, you are correct. I got confused.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bdi: fix cleanup when fail to percpu_counter_init
2017-09-19 8:13 ` Jan Kara
@ 2017-09-19 10:31 ` weiping zhang
0 siblings, 0 replies; 5+ messages in thread
From: weiping zhang @ 2017-09-19 10:31 UTC (permalink / raw)
To: Jan Kara; +Cc: Jens Axboe, tj, linux-mm
On Tue, Sep 19, 2017 at 10:13:31AM +0200, Jan Kara wrote:
> On Mon 18-09-17 08:04:04, Jens Axboe wrote:
> > On 09/15/2017 12:27 PM, weiping zhang wrote:
> > > when percpu_counter_init fail at i, 0 ~ (i-1) should be destoried, not
> > > 1 ~ i.
> > >
> > > Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
> > > ---
> > > mm/backing-dev.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> > > index e19606b..d399d3c 100644
> > > --- a/mm/backing-dev.c
> > > +++ b/mm/backing-dev.c
> > > @@ -334,7 +334,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi,
> > > return 0;
> > >
> > > out_destroy_stat:
> > > - while (i--)
> > > + while (--i >= 0)
> >
> > These two constructs will produce identical results.
>
> Bah, you are correct. I got confused.
>
It's my fault, thanks all of you, ^_^
weiping
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-19 10:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-15 18:27 [PATCH] bdi: fix cleanup when fail to percpu_counter_init weiping zhang
2017-09-18 8:35 ` Jan Kara
2017-09-18 14:04 ` Jens Axboe
2017-09-19 8:13 ` Jan Kara
2017-09-19 10:31 ` weiping zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).