linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jing zhang <zj.barak@gmail.com>
To: tytso@mit.edu
Cc: linux-ext4 <linux-ext4@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Andreas Dilger <adilger@sun.com>,
	Dave Kleikamp <shaggy@linux.vnet.ibm.com>,
	"Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [PATCH] ext4: add rb_tree cache to struct ext4_group_info
Date: Sun, 4 Apr 2010 09:26:26 +0800	[thread overview]
Message-ID: <p2xac8f92701004031826ice3889f1tc27211ac145de4fd@mail.gmail.com> (raw)
In-Reply-To: <20100403153413.GO8298@thunk.org>

2010/4/3, tytso@mit.edu <tytso@mit.edu>:
> On Wed, Mar 31, 2010 at 10:26:45PM +0800, jing zhang wrote:
>>
>> With the added cache, there is over 50% probability that the operation,
>>        rb_first(&(grp->bb_free_root));
>> can be saved, when there are multiple nodes in tree.
>>
>> It seems what is added is following what is called O(1), one of the
>> works by Mr. Ingo Molnar, but I am not sure, and let's ask Mr. Ingo
>> Molnar.
>
> Sure, but does it matter?  The red-black tree is per-block group, and
> rb_first() is O(ln n), and it's cleared after every transaction
> commit.  Have you measured how deep it gets?  Have you measured how
> much CPU time this would actually save?
>

Thanks for these questions, which were out of my consideration.

> I'm almost certiain the code complexity isn't worth it.  For example,
> your patch is buggy.  There are places where the red black tree is
> manipulated, and where the node pointed at by bb_free_cache could get
> freed.  For example, see release_blocks_on_commit() and
> ext4_mb_free_metadata().

I will check release_blocks_on_commit() and ext4_mb_free_metadata()
again next week.

>
> That being said, I'm not convinced ext4_mb_generate_from_freelist() is
> (a) necessary, or (b) bug-free, either.  The whole point of having
> extents in bb_free_root tree is that those extents aren't safe to be
> placed in the buddy bitmap.  And ext4_mb_generate_from_freelist()
> isn't freeing the nodes from the rbtree.  Fortunately it looks like
> ext4_mb_generate_from_freelist is only getting called when the buddy
> bitmap is being set up, so the rbtree should be empty during those
> times.
>
> I need to do some more investigation, but I think the function can be
> removed entirely.

Do you mean that ext4_mb_generate_from_freelist() can be removed entirely?

       - zj
>
> 						- Ted
>

  reply	other threads:[~2010-04-04  1:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-28  9:11 [PATCH] ext4: add rb_tree cache to struct ext4_group_info jing zhang
2010-03-28 15:03 ` Eric Sandeen
2010-03-29 13:40   ` jing zhang
2010-03-30 18:29 ` Aneesh Kumar K. V
2010-03-31 14:26 ` jing zhang
2010-04-03 15:34   ` tytso
2010-04-04  1:26     ` jing zhang [this message]
2010-04-04  2:06       ` tytso
2010-04-04  6:26         ` jing zhang

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=p2xac8f92701004031826ice3889f1tc27211ac145de4fd@mail.gmail.com \
    --to=zj.barak@gmail.com \
    --cc=adilger@sun.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=shaggy@linux.vnet.ibm.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 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).