2008-04-30 11:24:26

by Aneesh Kumar K.V

[permalink] [raw]
Subject: [PATCH] ext4: start seraching for the right extent from the goal group.

With mballoc we search for the best extent using different
criteria. We should always use the goal group when we are
starting with a new criteria.

Signed-off-by: Aneesh Kumar K.V <[email protected]>
---
fs/ext4/mballoc.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 2a6c814..9b4cde7 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1730,10 +1730,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
ac->ac_g_ex.fe_start = sbi->s_mb_last_start;
spin_unlock(&sbi->s_md_lock);
}
-
- /* searching for the right group start from the goal value specified */
- group = ac->ac_g_ex.fe_group;


2008-04-30 13:06:53

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH] ext4: start seraching for the right extent from the goal group.

Aneesh Kumar K.V wrote:
> With mballoc we search for the best extent using different
> criteria. We should always use the goal group when we are
> starting with a new criteria.

Aneesh, is there any testcase etc that will demonstrate the resulting
difference in layout?

It's not clear to me from this changelog (without looking at a lot more
context) exactly what you're changing and why...

thanks,
-eric

> Signed-off-by: Aneesh Kumar K.V <[email protected]>
> ---
> fs/ext4/mballoc.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 2a6c814..9b4cde7 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1730,10 +1730,6 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
> ac->ac_g_ex.fe_start = sbi->s_mb_last_start;
> spin_unlock(&sbi->s_md_lock);
> }
> -
> - /* searching for the right group start from the goal value specified */
> - group = ac->ac_g_ex.fe_group;
> -
> /* Let's just scan groups to find more-less suitable blocks */
> cr = ac->ac_2order ? 0 : 1;
> /*
> @@ -1743,6 +1739,12 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
> repeat:
> for (; cr < 4 && ac->ac_status == AC_STATUS_CONTINUE; cr++) {
> ac->ac_criteria = cr;
> + /*
> + * searching for the right group start
> + * from the goal value specified
> + */
> + group = ac->ac_g_ex.fe_group;
> +
> for (i = 0; i < EXT4_SB(sb)->s_groups_count; group++, i++) {
> struct ext4_group_info *grp;
> struct ext4_group_desc *desc;


2008-05-01 15:38:20

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: [PATCH] ext4: start seraching for the right extent from the goal group.

On Wed, Apr 30, 2008 at 07:58:35AM -0500, Eric Sandeen wrote:
> Aneesh Kumar K.V wrote:
> > With mballoc we search for the best extent using different
> > criteria. We should always use the goal group when we are
> > starting with a new criteria.
>
> Aneesh, is there any testcase etc that will demonstrate the resulting
> difference in layout?
>
> It's not clear to me from this changelog (without looking at a lot more
> context) exactly what you're changing and why...

I don't have any specific test case. With mballoc depending on the
request size we follow different criteria to allocate blocks. For
example if the size is stripe size multiple we use criteria 1 and start
searching for the right blocks from block group starting with goal
group. If we don't find right count of blocks, we use criteria 2 and start
searching from the group block 0. I guess with criteria 2 also, we should start
searching from the goal group so that when we find the right count of
blocks we find them close to the goal group.


-aneesh

2008-05-01 15:48:49

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: [PATCH] ext4: start seraching for the right extent from the goal group.

On Wed, Apr 30, 2008 at 04:15:11PM +0200, Valerie Clement wrote:
> Aneesh Kumar K.V wrote:
>> With mballoc we search for the best extent using different
>> criteria. We should always use the goal group when we are
>> starting with a new criteria.
>
> Hi Aneesh,
>
> as you are working on the mballoc code, there is another thing
> which is not clear for me: why skipping uninitialized groups in
> ext4_mb_good_group() when criteria is 0.
> I'm doing tests on large partition (~2TB) and on FS with 1KB
> block size and it impacts the performance when the number of
> groups is great (and the uninit_groups feature is used of course).
> For which reason we skip these groups ?
>

The reason is to avoid initializing block group. We would like to make
sure when we are allocating blocks we allocate them from already
initialized group. Otherwise we would end up initializing multiple block
group with in turn decrease the performance advantage of uninit_group.

The current logic is.

If request len is order of 2 we start with cr=0.

If we are cr=0 skip the uninit block group and search for the right
count of blocks in other initialized block group using simple_scan
logic.

If we don't find the right count of blocks then cr++;

if cr != 0 don't skip uninit block group.

if group is uninit and the request size is order of 2 use the
simple_scan logic which use buddy cache to search for the right count of
block group.

That way we avoid allocating blocks out of uninit group in the first
loop. We allocate blocks only after we looked at all the other
initialized block group.


-aneesh

2008-05-02 18:53:23

by Andreas Dilger

[permalink] [raw]
Subject: Re: [PATCH] ext4: start seraching for the right extent from the goal group.

On May 01, 2008 21:07 +0530, Aneesh Kumar K.V wrote:
> On Wed, Apr 30, 2008 at 07:58:35AM -0500, Eric Sandeen wrote:
> > Aneesh Kumar K.V wrote:
> > > With mballoc we search for the best extent using different
> > > criteria. We should always use the goal group when we are
> > > starting with a new criteria.
> >
> > Aneesh, is there any testcase etc that will demonstrate the resulting
> > difference in layout?
> >
> > It's not clear to me from this changelog (without looking at a lot more
> > context) exactly what you're changing and why...
>
> I don't have any specific test case. With mballoc depending on the
> request size we follow different criteria to allocate blocks. For
> example if the size is stripe size multiple we use criteria 1 and start
> searching for the right blocks from block group starting with goal
> group. If we don't find right count of blocks, we use criteria 2 and start
> searching from the group block 0. I guess with criteria 2 also, we should start
> searching from the goal group so that when we find the right count of
> blocks we find them close to the goal group.

This makes sense to me.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


2008-05-02 21:11:54

by Mingming Cao

[permalink] [raw]
Subject: Re: [PATCH] ext4: start seraching for the right extent from the goal group.

On Thu, 2008-05-01 at 21:07 +0530, Aneesh Kumar K.V wrote:
> On Wed, Apr 30, 2008 at 07:58:35AM -0500, Eric Sandeen wrote:
> > Aneesh Kumar K.V wrote:
> > > With mballoc we search for the best extent using different
> > > criteria. We should always use the goal group when we are
> > > starting with a new criteria.
> >
> > Aneesh, is there any testcase etc that will demonstrate the resulting
> > difference in layout?
> >
> > It's not clear to me from this changelog (without looking at a lot more
> > context) exactly what you're changing and why...
>
> I don't have any specific test case. With mballoc depending on the
> request size we follow different criteria to allocate blocks. For
> example if the size is stripe size multiple we use criteria 1 and start
> searching for the right blocks from block group starting with goal
> group. If we don't find right count of blocks, we use criteria 2 and start
> searching from the group block 0. I guess with criteria 2 also, we should start
> searching from the goal group so that when we find the right count of
> blocks we find them close to the goal group.
>

Sounds reasoanble to me. I added this patch in the ext4 patch queue
>
> -aneesh