linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>,
	linux-ext4@vger.kernel.org,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Ojaswin Mujoo <ojaswin@linux.ibm.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>
Subject: Re: [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups
Date: Thu, 8 Sep 2022 14:54:49 +0530	[thread overview]
Message-ID: <20220908092449.dl5ar4wbhm5cxii2@riteshh-domain> (raw)
In-Reply-To: <20220908085717.2kln432koqxbz3ja@quack3>

On 22/09/08 10:57AM, Jan Kara wrote:
> On Wed 07-09-22 23:35:07, Ritesh Harjani (IBM) wrote:
> > On 22/09/06 05:29PM, Jan Kara wrote:
> > > mb_set_largest_free_order() updates lists containing groups with largest
> > > chunk of free space of given order. The way it updates it leads to
> > > always moving the group to the tail of the list. Thus allocations
> > > looking for free space of given order effectively end up cycling through
> > > all groups (and due to initialization in last to first order). This
> > > spreads allocations among block groups which reduces performance for
> > > rotating disks or low-end flash media. Change
> > > mb_set_largest_free_order() to only update lists if the order of the
> > > largest free chunk in the group changed.
> > 
> > Nice and clear explaination. Thanks :)
> > 
> > This change also looks good to me.
> > Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> 
> Thanks for review!
> 
> > One other thought to further optimize - 
> > Will it make a difference if rather then adding the group to the tail of the list, 
> > we add that group to the head of sbi->s_mb_largest_free_orders[new_order]. 
> > 
> > This is because this group is the latest from where blocks were allocated/freed,
> > and hence the next allocation should first try from this group in order to keep 
> > the files/extents blocks close to each other? 
> > (That sometimes might help with disk firmware to avoid doing discards if the freed 
> > block can be reused?)
> > 
> > Or does goal block will always cover that case by default and we might never
> > require this? Maybe in a case of a new file within the same directory where 
> > the goal group has no free blocks, but the last group attempted should be 
> > retried first?
> 
> So I was also wondering about this somewhat. I think that goal group will
> take care of keeping file data together so head/tail insertion should not
> matter too much for one file. Maybe if the allocation comes from a
> different inode, then the head/tail insertion matters but then it is not
> certain whether the allocation is actually related and what its order is
> (depending on that we might prefer same / different group) so I've decided
> to just keep things as they are. I agree it might be interesting to
> investigate and experiment with various workloads and see whether the
> head/tail insertion makes a difference for some workload but I think it's a
> separate project.
> 

Sure. Make sense.
Thanks for still sharing your thoughts on it.

-ritesh

  reply	other threads:[~2022-09-08  9:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 15:29 [PATCH 0/5 v2] ext4: Fix performance regression with mballoc Jan Kara
2022-09-06 15:29 ` [PATCH 1/5] ext4: Make mballoc try target group first even with mb_optimize_scan Jan Kara
2022-09-07 17:43   ` Ritesh Harjani (IBM)
2022-09-06 15:29 ` [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups Jan Kara
2022-09-07 18:05   ` Ritesh Harjani (IBM)
2022-09-08  8:57     ` Jan Kara
2022-09-08  9:24       ` Ritesh Harjani (IBM) [this message]
2022-09-06 15:29 ` [PATCH 3/5] ext4: Make directory inode spreading reflect flexbg size Jan Kara
2022-09-06 15:29 ` [PATCH 4/5] ext4: Use locality group preallocation for small closed files Jan Kara
2022-09-07 18:25   ` Ritesh Harjani (IBM)
2022-09-06 15:29 ` [PATCH 5/5] ext4: Use buckets for cr 1 block scan instead of rbtree Jan Kara
2022-09-07 18:41   ` Ritesh Harjani (IBM)
2022-09-08  9:01     ` Jan Kara
2022-09-08  9:23       ` Ritesh Harjani (IBM)
2022-09-08  8:29   ` Ojaswin Mujoo
2022-09-08  9:03     ` Jan Kara
2022-09-08 11:00   ` Dan Carpenter
2022-09-08 11:33     ` Jan Kara
2022-09-06 20:38 ` [PATCH 0/5 v2] ext4: Fix performance regression with mballoc Stefan Wahren
2022-09-07 10:49   ` Jan Kara
2022-09-07 13:02     ` Jan Kara
2022-09-08  8:17 ` Ojaswin Mujoo
2022-09-08  9:12   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2022-09-08  9:21 [PATCH 0/5 v3] " Jan Kara
2022-09-08  9:21 ` [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups Jan Kara

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=20220908092449.dl5ar4wbhm5cxii2@riteshh-domain \
    --to=ritesh.list@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=regressions@leemhuis.info \
    --cc=stefan.wahren@i2se.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).