From: Lukas Czerner <lczerner@redhat.com>
To: Ric Wheeler <rwheeler@redhat.com>
Cc: Lukas Czerner <lczerner@redhat.com>, Jan Kara <jack@suse.cz>,
Greg Freemyer <greg.freemyer@gmail.com>,
Jeff Moyer <jmoyer@redhat.com>, Eric Sandeen <sandeen@redhat.com>,
Mark Lord <kernel@teksavvy.com>,
linux-ext4@vger.kernel.org, Edward Shishkin <eshishki@redhat.com>,
Eric Sandeen <esandeen@redhat.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 2/2] Add batched discard support for ext4.
Date: Mon, 26 Apr 2010 20:14:34 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1004261957001.29999@localhost> (raw)
In-Reply-To: <4BD5D2EA.1070008@redhat.com>
On Mon, 26 Apr 2010, Ric Wheeler wrote:
> On 04/26/2010 01:46 PM, Lukas Czerner wrote:
> > On Mon, 26 Apr 2010, Jan Kara wrote:
> >
> > > > On Wed, 21 Apr 2010, Greg Freemyer wrote:
> > > > And also, currently I am rewriting the patch do use rbtree instead of
> > > > the
> > > > bitmap, because there were some concerns of memory consumption. It is a
> > > > question whether or not the rbtree will be more memory friendly.
> > > > Generally I think that in most "normal" cases it will, but there are
> > > > some
> > > > extreme scenarios, where the rbtree will be much worse. Any comment on
> > > > this ?
> > > I see two possible improvements here:
> > > a) At a cost of some code complexity, you can bound the worst case by
> > > combining
> > > RB-trees with bitmaps. The basic idea is that when space to TRIM gets too
> > > fragmented (memory to keep to-TRIM blocks in RB-tree for a given group
> > > exceeds
> > > the memory needed to keep it in a bitmap), you convert RB-tree for a
> > > problematic group to a bitmap and attach it to an appropriate RB-node. If
> > > you
> > > track with a bitmap also a number of to-TRIM extents in the bitmap, you
> > > can
> > > also decide whether it's benefitial to switch back to an RB-tree.
> >
> > This sounds like a good idea, but I wonder if it is worth it :
> > 1. The tree will have very short life, because with next ioctl all
> > stored deleted extents will be trimmed and removed from the tree.
> > 2. Also note, that the longer it lives the less fragmented it possibly
> > became.
> > 3. I do not expect, that deleted ranges can be too fragmented, and
> > even if it is, it will be probably merged into one big extent very
> > soon.
> >
> > >
> > > b) Another idea might be: When to-TRIM space is fragmented (again, let's
> > > say
> > > in some block group), there's not much point in sending tiny trim commands
> > > anyway (at least that's what I've understood from this discussion). So you
> > > might as well stop maintaining information which blocks we need to trim
> > > for that group. When the situation gets better, you can always walk block
> > > bitmap and issue trim commands. You might even trigger this rescan from
> > > kernel - if you'd maintain number of free block extents for each block
> > > group
> > > (which is rather easy), you could trigger the bitmap rescan and trim as
> > > soon
> > > as ratio number of free blocks / number of extents gets above a reasonable
> > > threshold.
> > >
> > > Honza
> > >
> >
> > In what I am preparing now, I simple ignore small extents, which would
> > be created by splitting the deleted extent into smaller pieces by chunks
> > of used blocks. This, in my opinion, will prevent the fragmentation,
> > which otherwise may occur in the longer term (between ioctl calls).
> >
> > Thanks for suggestions.
> > -Lukas
>
> I am not convinced that ignoring small extents is a good idea. Remember that
> for SSD's specifically, they remap *everything* internally so our
> "fragmentation" set of small spaces could be useful for them.
>
> That does not mean that we should not try to send larger requests down to the
> target device which is always a good idea I think :-)
>
> ric
>
That's right, so the other approach would be probably better. Merge
small extents together into one, but there must be some limit, because I
do not want two little extents at the beginning and the end of the group
to force trimming whole group. The whole rbtree thing gets a little
complicated :)
-Lukas
next prev parent reply other threads:[~2010-04-26 18:14 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-19 10:55 Ext4: batched discard support Lukas Czerner
2010-04-19 10:55 ` [PATCH 1/2] Add ioctl FITRIM Lukas Czerner
2010-04-19 10:55 ` [PATCH 2/2] Add batched discard support for ext4 Lukas Czerner
2010-04-20 21:21 ` Greg Freemyer
2010-04-21 2:26 ` Mark Lord
2010-04-21 2:45 ` Eric Sandeen
2010-04-21 18:59 ` Greg Freemyer
2010-04-21 19:04 ` Ric Wheeler
2010-04-21 19:22 ` Jeff Moyer
2010-04-21 20:44 ` Greg Freemyer
2010-04-21 20:53 ` Greg Freemyer
2010-04-21 21:01 ` Eric Sandeen
2010-04-21 21:03 ` Ric Wheeler
2010-04-21 21:47 ` Greg Freemyer
2010-04-21 21:56 ` James Bottomley
2010-04-21 21:59 ` Mark Lord
2010-04-23 8:23 ` Lukas Czerner
2010-04-24 13:24 ` Greg Freemyer
2010-04-24 13:48 ` Ric Wheeler
2010-04-24 14:30 ` Greg Freemyer
2010-04-24 14:43 ` Eric Sandeen
2010-04-24 15:03 ` Greg Freemyer
2010-04-24 17:04 ` Ric Wheeler
2010-04-24 18:30 ` Greg Freemyer
2010-04-24 18:41 ` Ric Wheeler
2010-04-26 14:00 ` Mark Lord
2010-04-26 14:42 ` Martin K. Petersen
2010-04-26 15:27 ` Greg Freemyer
2010-04-26 15:51 ` Lukas Czerner
2010-04-28 1:25 ` Mark Lord
2010-04-26 15:48 ` Ric Wheeler
2010-04-24 19:06 ` Martin K. Petersen
2010-04-26 14:03 ` Mark Lord
2010-04-24 18:39 ` Martin K. Petersen
2010-04-26 16:55 ` Jan Kara
2010-04-26 17:46 ` Lukas Czerner
2010-04-26 17:52 ` Ric Wheeler
2010-04-26 18:14 ` Lukas Czerner [this message]
2010-04-26 18:28 ` Jeff Moyer
2010-04-26 18:38 ` [PATCH 2/2] Add batched discard support for ext4 - using rbtree Lukas Czerner
2010-04-26 18:42 ` Lukas Czerner
2010-04-27 15:29 ` Edward Shishkin
2010-04-21 20:52 ` [PATCH 2/2] Add batched discard support for ext4 Greg Freemyer
2010-04-19 16:20 ` Ext4: batched discard support Greg Freemyer
2010-04-19 16:30 ` Eric Sandeen
2010-04-19 17:58 ` Greg Freemyer
2010-04-19 18:04 ` Ric Wheeler
2010-04-20 20:24 ` Mark Lord
2010-04-20 20:34 ` Mark Lord
-- strict thread matches above, loose matches on Subject: below --
2010-07-07 7:53 Ext4: batched discard support - simplified version Lukas Czerner
2010-07-07 7:53 ` [PATCH 2/2] Add batched discard support for ext4 Lukas Czerner
2010-07-14 8:33 ` Dmitry Monakhov
2010-07-14 9:40 ` Lukas Czerner
2010-07-14 10:03 ` Dmitry Monakhov
2010-07-14 11:43 ` Lukas Czerner
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=alpine.LFD.2.00.1004261957001.29999@localhost \
--to=lczerner@redhat.com \
--cc=esandeen@redhat.com \
--cc=eshishki@redhat.com \
--cc=greg.freemyer@gmail.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=kernel@teksavvy.com \
--cc=linux-ext4@vger.kernel.org \
--cc=rwheeler@redhat.com \
--cc=sandeen@redhat.com \
/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).