linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Liu Song <fishland@aliyun.com>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	liu.song11@zte.com.cn
Subject: Re: [RFC PATCH] ext4: remove code that does not perform much optimization in find_group_orlov
Date: Mon, 27 Jan 2020 14:44:24 -0700	[thread overview]
Message-ID: <6A331F39-D25C-4970-9A6D-229B24E25D37@dilger.ca> (raw)
In-Reply-To: <20200127101352.35170-1-fishland@aliyun.com>

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Jan 27, 2020, at 3:13 AM, Liu Song <fishland@aliyun.com> wrote:
> 
> From: Liu Song <liu.song11@zte.com.cn>
> 
> Even if "best_ndir" has already taken the final value, it still
> needs to traverse all the block groups. It is better to simplify
> the code and increase readability.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>
> ---
> fs/ext4/ialloc.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
> 
> @@ -447,17 +447,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
> 		int best_ndir = inodes_per_group;
> 		int ret = -1;
> 
> -		if (qstr) {
> -			hinfo.hash_version = DX_HASH_HALF_MD4;
> -			hinfo.seed = sbi->s_hash_seed;
> -			ext4fs_dirhash(parent, qstr->name, qstr->len, &hinfo);
> -			grp = hinfo.hash;
> -		} else
> -			grp = prandom_u32();
> -		parent_group = (unsigned)grp % ngroups;
> 		for (i = 0; i < ngroups; i++) {
> -			g = (parent_group + i) % ngroups;
> -			get_orlov_stats(sb, g, flex_size, &stats);
> +			get_orlov_stats(sb, i, flex_size, &stats);

It isn't clear to me that this is an improvement?  This means that *all*
new group allocations will start searching at group = 0, which will
increase contention on the early block groups.  With the current code,
the starting block group is distributed across the filesystem, as it
is possible that there are multiple groups that have the same score.

We might consider to improve the group selection for non-rotational storage,
since we don't care as much about groups on the inner vs. outer tracks.

Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

           reply	other threads:[~2020-01-27 21:44 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200127101352.35170-1-fishland@aliyun.com>]

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=6A331F39-D25C-4970-9A6D-229B24E25D37@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=fishland@aliyun.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.song11@zte.com.cn \
    --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).