* [PATCH] percpu : fix the memory leak @ 2010-08-08 9:53 Huang Shijie 2010-08-08 12:42 ` [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() Tejun Heo 0 siblings, 1 reply; 8+ messages in thread From: Huang Shijie @ 2010-08-08 9:53 UTC (permalink / raw) To: akpm; +Cc: tj, linux-mm, Huang Shijie The origin code did not free the old map. The patch fixes it. Signed-off-by: Huang Shijie <shijie8@gmail.com> --- mm/percpu.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index e61dc2c..d1c94e3 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -393,6 +393,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) goto out_unlock; old_size = chunk->map_alloc * sizeof(chunk->map[0]); + old = chunk->map; memcpy(new, chunk->map, old_size); chunk->map_alloc = new_alloc; -- 1.6.6.1 -- 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] 8+ messages in thread
* [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() 2010-08-08 9:53 [PATCH] percpu : fix the memory leak Huang Shijie @ 2010-08-08 12:42 ` Tejun Heo 2010-08-26 22:10 ` Andrew Morton 2010-09-16 21:36 ` breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) Peter Palfrader 0 siblings, 2 replies; 8+ messages in thread From: Tejun Heo @ 2010-08-08 12:42 UTC (permalink / raw) To: Huang Shijie; +Cc: akpm, linux-mm, lkml ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() 2010-08-08 12:42 ` [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() Tejun Heo @ 2010-08-26 22:10 ` Andrew Morton 2010-08-27 9:32 ` Tejun Heo 2010-09-16 21:36 ` breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) Peter Palfrader 1 sibling, 1 reply; 8+ messages in thread From: Andrew Morton @ 2010-08-26 22:10 UTC (permalink / raw) To: Tejun Heo; +Cc: Huang Shijie, linux-mm, lkml On Sun, 08 Aug 2010 14:42:57 +0200 Tejun Heo <tj@kernel.org> wrote: > >From 206c53730b8b1707becca7a868ea8d14ebee24d2 Mon Sep 17 00:00:00 2001 > From: Huang Shijie <shijie8@gmail.com> > Date: Sun, 8 Aug 2010 14:39:07 +0200 > > The original code did not free the old map. This patch fixes it. > > tj: use @old as memcpy source instead of @chunk->map, and indentation > and description update > > Signed-off-by: Huang Shijie <shijie8@gmail.com> > Signed-off-by: Tejun Heo <tj@kernel.org> Should have had a cc:stable in the changelog, IMO. > --- > Patch applied to percpu#for-linus w/ some updates. Thanks a lot for > catching this. > This patch appears to have been lost? > diff --git a/mm/percpu.c b/mm/percpu.c > index e61dc2c..a1830d8 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -393,7 +393,9 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) > goto out_unlock; > > old_size = chunk->map_alloc * sizeof(chunk->map[0]); > - memcpy(new, chunk->map, old_size); > + old = chunk->map; > + > + memcpy(new, old, old_size); > > chunk->map_alloc = new_alloc; > chunk->map = new; -- 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] 8+ messages in thread
* Re: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() 2010-08-26 22:10 ` Andrew Morton @ 2010-08-27 9:32 ` Tejun Heo 0 siblings, 0 replies; 8+ messages in thread From: Tejun Heo @ 2010-08-27 9:32 UTC (permalink / raw) To: Andrew Morton; +Cc: Huang Shijie, linux-mm, lkml Hello, On 08/27/2010 12:10 AM, Andrew Morton wrote: >> Patch applied to percpu#for-linus w/ some updates. Thanks a lot for >> catching this. > > This patch appears to have been lost? It has been in percpu#for-linus. Given the way percpu allocator is currently used, the bug isn't likely to cause any real leakage, so I was waiting a bit before pushing it out. I'll push it today. Thanks. -- tejun -- 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] 8+ messages in thread
* breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) 2010-08-08 12:42 ` [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() Tejun Heo 2010-08-26 22:10 ` Andrew Morton @ 2010-09-16 21:36 ` Peter Palfrader 2010-09-16 23:13 ` [stable] " Greg KH 1 sibling, 1 reply; 8+ messages in thread From: Peter Palfrader @ 2010-09-16 21:36 UTC (permalink / raw) To: stable; +Cc: Tejun Heo, Huang Shijie, akpm, linux-mm, lkml Hey, The patch quoted below seems to have made it into Greg's stable-queue for 2.6.32. I tried building a kernel based on 2.6.32.21 plus all the patches currently in that queue. The resulting kernel unfortunately didn't boot for me, neither as a 32 nor as 64 bit x86 kernel. I have put up a screenshot of a trace at http://asteria.noreply.org/~weasel/volatile/2010-09-16-SrLl9JHtDTg/trace-64bit.png since the kernel fortunately also died in kvm - unfortunately only the last 60 lines are easily available. If you need more I could try to set up some serial console thing to catch more. Bisecting led to this patch and reverting "percpu: fix a memory leak in pcpu_extend_area_map()" makes the kernel boot for me again. > From 206c53730b8b1707becca7a868ea8d14ebee24d2 Mon Sep 17 00:00:00 2001 > From: Huang Shijie <shijie8@gmail.com> > Date: Sun, 8 Aug 2010 14:39:07 +0200 > > The original code did not free the old map. This patch fixes it. > > tj: use @old as memcpy source instead of @chunk->map, and indentation > and description update > > Signed-off-by: Huang Shijie <shijie8@gmail.com> > Signed-off-by: Tejun Heo <tj@kernel.org> > --- > Patch applied to percpu#for-linus w/ some updates. Thanks a lot for > catching this. > > mm/percpu.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/mm/percpu.c b/mm/percpu.c > index e61dc2c..a1830d8 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -393,7 +393,9 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) > goto out_unlock; > > old_size = chunk->map_alloc * sizeof(chunk->map[0]); > - memcpy(new, chunk->map, old_size); > + old = chunk->map; > + > + memcpy(new, old, old_size); > > chunk->map_alloc = new_alloc; > chunk->map = new; Cheers, Peter -- | .''`. ** Debian GNU/Linux ** Peter Palfrader | : :' : The universal http://www.palfrader.org/ | `. `' Operating System | `- http://www.debian.org/ -- 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] 8+ messages in thread
* Re: [stable] breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) 2010-09-16 21:36 ` breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) Peter Palfrader @ 2010-09-16 23:13 ` Greg KH 2010-09-17 13:47 ` [stable] breaks 2.6.32.21+ Tejun Heo 0 siblings, 1 reply; 8+ messages in thread From: Greg KH @ 2010-09-16 23:13 UTC (permalink / raw) To: Peter Palfrader, stable, Tejun Heo, Huang Shijie, akpm, linux-mm, lkml On Thu, Sep 16, 2010 at 11:36:03PM +0200, Peter Palfrader wrote: > Hey, > > The patch quoted below seems to have made it into Greg's stable-queue > for 2.6.32. > > I tried building a kernel based on 2.6.32.21 plus all the patches > currently in that queue. The resulting kernel unfortunately didn't > boot for me, neither as a 32 nor as 64 bit x86 kernel. > > I have put up a screenshot of a trace at > http://asteria.noreply.org/~weasel/volatile/2010-09-16-SrLl9JHtDTg/trace-64bit.png > since the kernel fortunately also died in kvm - unfortunately only the > last 60 lines are easily available. If you need more I could try to set > up some serial console thing to catch more. > > Bisecting led to this patch and reverting "percpu: fix a memory leak in > pcpu_extend_area_map()" makes the kernel boot for me again. Odd, someone just reported the same problem for .35-stable as well. Tejun, what's going on here? thanks, greg k-h > > > From 206c53730b8b1707becca7a868ea8d14ebee24d2 Mon Sep 17 00:00:00 2001 > > From: Huang Shijie <shijie8@gmail.com> > > Date: Sun, 8 Aug 2010 14:39:07 +0200 > > > > The original code did not free the old map. This patch fixes it. > > > > tj: use @old as memcpy source instead of @chunk->map, and indentation > > and description update > > > > Signed-off-by: Huang Shijie <shijie8@gmail.com> > > Signed-off-by: Tejun Heo <tj@kernel.org> > > --- > > Patch applied to percpu#for-linus w/ some updates. Thanks a lot for > > catching this. > > > > mm/percpu.c | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > diff --git a/mm/percpu.c b/mm/percpu.c > > index e61dc2c..a1830d8 100644 > > --- a/mm/percpu.c > > +++ b/mm/percpu.c > > @@ -393,7 +393,9 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) > > goto out_unlock; > > > > old_size = chunk->map_alloc * sizeof(chunk->map[0]); > > - memcpy(new, chunk->map, old_size); > > + old = chunk->map; > > + > > + memcpy(new, old, old_size); > > > > chunk->map_alloc = new_alloc; > > chunk->map = new; > > Cheers, > Peter > -- > | .''`. ** Debian GNU/Linux ** > Peter Palfrader | : :' : The universal > http://www.palfrader.org/ | `. `' Operating System > | `- http://www.debian.org/ > > _______________________________________________ > stable mailing list > stable@linux.kernel.org > http://linux.kernel.org/mailman/listinfo/stable -- 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] 8+ messages in thread
* Re: [stable] breaks 2.6.32.21+ 2010-09-16 23:13 ` [stable] " Greg KH @ 2010-09-17 13:47 ` Tejun Heo 2010-09-17 16:36 ` Greg KH 0 siblings, 1 reply; 8+ messages in thread From: Tejun Heo @ 2010-09-17 13:47 UTC (permalink / raw) To: Greg KH; +Cc: Peter Palfrader, stable, Huang Shijie, akpm, linux-mm, lkml On 09/17/2010 01:13 AM, Greg KH wrote: > Odd, someone just reported the same problem for .35-stable as well. > > Tejun, what's going on here? Please drop it. The memory leak was introduced after 2.6.36-rc1. I got confused which commit was in which kernel. I'll be more careful with stable cc's. Sorry about that. -- tejun -- 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] 8+ messages in thread
* Re: [stable] breaks 2.6.32.21+ 2010-09-17 13:47 ` [stable] breaks 2.6.32.21+ Tejun Heo @ 2010-09-17 16:36 ` Greg KH 0 siblings, 0 replies; 8+ messages in thread From: Greg KH @ 2010-09-17 16:36 UTC (permalink / raw) To: Tejun Heo; +Cc: Peter Palfrader, stable, Huang Shijie, akpm, linux-mm, lkml On Fri, Sep 17, 2010 at 03:47:35PM +0200, Tejun Heo wrote: > On 09/17/2010 01:13 AM, Greg KH wrote: > > Odd, someone just reported the same problem for .35-stable as well. > > > > Tejun, what's going on here? > > Please drop it. The memory leak was introduced after 2.6.36-rc1. I > got confused which commit was in which kernel. I'll be more careful > with stable cc's. Sorry about that. No problem, now dropped. thanks, greg k-h -- 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] 8+ messages in thread
end of thread, other threads:[~2010-09-17 16:38 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-08 9:53 [PATCH] percpu : fix the memory leak Huang Shijie 2010-08-08 12:42 ` [PATCH] percpu: fix a memory leak in pcpu_extend_area_map() Tejun Heo 2010-08-26 22:10 ` Andrew Morton 2010-08-27 9:32 ` Tejun Heo 2010-09-16 21:36 ` breaks 2.6.32.21+ (was: [PATCH] percpu: fix a memory leak in pcpu_extend_area_map()) Peter Palfrader 2010-09-16 23:13 ` [stable] " Greg KH 2010-09-17 13:47 ` [stable] breaks 2.6.32.21+ Tejun Heo 2010-09-17 16:36 ` Greg KH
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).