From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Theodore Tso <tytso@mit.edu>
Cc: cmm@us.ibm.com, sandeen@redhat.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Use an rb tree for tracking blocks freed during transaction.
Date: Mon, 13 Oct 2008 15:16:29 +0530 [thread overview]
Message-ID: <20081013094629.GA7819@skywalker> (raw)
In-Reply-To: <20081012203147.GF12662@mit.edu>
On Sun, Oct 12, 2008 at 04:31:47PM -0400, Theodore Tso wrote:
> On Thu, Oct 09, 2008 at 09:02:07PM +0530, Aneesh Kumar K.V wrote:
> > With this patch we track the block freed during a transaction using
> > rb tree. We also make sure contiguos blocks freed are collected
> > in one rb node.
>
> There seems to be a memory leak. Over time, the number of active
> objects in ext4_free_block_extents goes up. You can check via:
>
> grep ext4_free_block_extents /proc/slabinfo
>
> I think the problem is here:
>
> > + /* Now try to see the extent can be merged to left and right */
> > + node = rb_prev(new_node);
> > + if (node) {
> > + entry = rb_entry(node, struct ext4_free_data, node);
> > + if (can_merge(entry, new_entry)) {
> > + new_entry->start_blk = entry->start_blk;
> > + new_entry->count += entry->count;
> > + rb_erase(node, &(db->bb_free_root));
> > + list_del(&entry->list);
> > }
> > + }
>
> We aren't freeing new_entry in ext4_mb_free_metadata() in the case
> where the extent can be merged with an existing node in the rbtree.
>
Updated with the below patch
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 9c151f2..2f38754 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4492,7 +4492,10 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
new_entry->start_blk = entry->start_blk;
new_entry->count += entry->count;
rb_erase(node, &(db->bb_free_root));
+ spin_lock(&sbi->s_md_lock);
list_del(&entry->list);
+ spin_unlock(&sbi->s_md_lock);
+ kmem_cache_free(ext4_free_ext_cachep, entry);
}
}
@@ -4502,7 +4505,10 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
if (can_merge(new_entry, entry)) {
new_entry->count += entry->count;
rb_erase(node, &(db->bb_free_root));
+ spin_lock(&sbi->s_md_lock);
list_del(&entry->list);
+ spin_unlock(&sbi->s_md_lock);
+ kmem_cache_free(ext4_free_ext_cachep, entry);
}
}
/* Add the extent to active_transaction list */
prev parent reply other threads:[~2008-10-13 9:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 15:32 [PATCH] ext4: Use an rb tree for tracking blocks freed during transaction Aneesh Kumar K.V
2008-10-09 15:32 ` [PATCH] ext4: Don't reuse released data blocks untill transaction commits Aneesh Kumar K.V
2008-10-09 15:32 ` [PATCH] ext4: Do mballoc init before doing filesystem recovery Aneesh Kumar K.V
2008-10-12 20:33 ` [PATCH] ext4: Don't reuse released data blocks untill transaction commits Theodore Tso
2008-10-11 4:27 ` [PATCH] ext4: Use an rb tree for tracking blocks freed during transaction Theodore Tso
2008-10-11 18:08 ` Aneesh Kumar K.V
2008-10-12 20:31 ` Theodore Tso
2008-10-13 9:46 ` Aneesh Kumar K.V [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081013094629.GA7819@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.