ext4: start seraching for the right extent from the goal group.
PATCH 1/1 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.
--- fs/ext4/mballoc.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
fs/ext4/mballoc.c +0 -3
@@ -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;
Quoted 3 lines · Aneesh Kumar K.V
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
Quoted 33 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>--- fs/ext4/mballoc.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)fs/ext4/mballoc.c +6
-4@@ -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;
Quoted 10 lines · Eric Sandeen
Quoted 3 lines · Aneesh Kumar K.V
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
Quoted 7 lines · Valerie Clement
Quoted 3 lines · Aneesh Kumar K.V
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,
Quoted 8 lines
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 theuninit_groupsfeature 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
Quoted 12 lines · Aneesh Kumar K.V
Quoted 10 lines · Eric Sandeen
Quoted 3 lines · Aneesh Kumar K.V
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...
Quoted 8 lines
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.
Quoted 12 lines · Aneesh Kumar K.V
Quoted 10 lines · Eric Sandeen
Quoted 3 lines · Aneesh Kumar K.V
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...
Quoted 9 lines
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
Quoted 2 lines
-aneesh