FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 04-12-2012, 10:34 PM
Mike Snitzer
 
Default dm thin: fix memory leak of singleton bio-prison cell

Add missing mempool_free() to __cell_release_singleton().

This is a pretty significant leak that will accumulate to over 2GB of
leaked memory just from running the full thinp-test-suite. Leak was
known to exist but the kmalloc_pool which was used for prison cell
allocation caused all leaked memory to be attributed to the "size-128"
cache. kmemleak proved useful in identifying the source of this
illusive leak.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm-thin.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/md/dm-thin.c
================================================== =================
--- linux-2.6.orig/drivers/md/dm-thin.c
+++ linux-2.6/drivers/md/dm-thin.c
@@ -279,8 +279,10 @@ static void __cell_release(struct cell *

hlist_del(&cell->list);

- bio_list_add(inmates, cell->holder);
- bio_list_merge(inmates, &cell->bios);
+ if (inmates) {
+ bio_list_add(inmates, cell->holder);
+ bio_list_merge(inmates, &cell->bios);
+ }

mempool_free(cell, prison->cell_pool);
}
@@ -303,9 +305,10 @@ static void cell_release(struct cell *ce
*/
static void __cell_release_singleton(struct cell *cell, struct bio *bio)
{
- hlist_del(&cell->list);
BUG_ON(cell->holder != bio);
BUG_ON(!bio_list_empty(&cell->bios));
+
+ __cell_release(cell, NULL);
}

static void cell_release_singleton(struct cell *cell, struct bio *bio)

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 04-23-2012, 07:24 AM
Joe Thornber
 
Default dm thin: fix memory leak of singleton bio-prison cell

On Thu, Apr 12, 2012 at 06:34:34PM -0400, Mike Snitzer wrote:
> Add missing mempool_free() to __cell_release_singleton().
>
> This is a pretty significant leak that will accumulate to over 2GB of
> leaked memory just from running the full thinp-test-suite.

When was this introduced? With agk's tweaks for 3.4?

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 01:38 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org