All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Lehmann <schmorp@schmorp.de>
To: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: more gc / gc script refinements
Date: Mon, 5 Oct 2015 09:25:49 +0200	[thread overview]
Message-ID: <20151005072548.GA2504@schmorp.de> (raw)
In-Reply-To: <20151004124923.GC3697@schmorp.de>

After I successfully filled the disk, it was time to see hope f2fs recovers
from this bad situation, by deleting a lot of files and filling it again.

To ease the load on the gc, but still present a bit of a challenge, I
deleted the first 12000 files out of every 80000 files (directory order), in the hope
that this carves out comparatively big chunks.

I started with "Dirty: 30k" and "Free: 45k" and ended up with
"Dirty: 216k" and "Free: 968k", which to me seems to indicate it kind of
worked, although I am not suire how contiguous this free space really is
(I oriignally hoped this would be in the form of mostly free sections).

Then I worked on my GC script. Since the box became mostly unusable by just
calling the GC, I first tried this refinement:

http://ue.tst.eu/38809274b56fe9b161492f09b5411071.txt

(Used like "script </mountpoint" btw.)

Or in other words, only call the GC if there is less than 2GB of dirty
pages. For lower values than 2GB the GC often didn't run at all for 10-20
seconds.

This helped a lot, but the box was still noticably sluggish, and I
realised why the current GC I/O implementation is wrong - the purpose of
the cache is (among other uses, such as being the normal way to do I/O) to
cache recently-requested data in the hope that it will be reused.

However, in the case of the GC, unless the data was in the cache before,
chances that this data is required later are just as low as for the rest of
the device, and in general, much lower then the data that was in the cache
before f2fs evicted it.

Moreso, a lot of stress is put on the page cache because of the f2fs gc
treating it as normal data and leaving it in the cache and up to the
kernel to write out the pages.

What the GC should do is minimize the impact of the GC on the rest of the
system, by immediately flushing the data out and expiring the pages.

To improve the situaiton somewhat I decided to experiment with fdatasync
on the block device and/or a directory handle, but ended up calling syncfs
on the f2fs fs after every gc call, because fdatasync etc. seemed to be
the equivalent of syncfs anyway:

http://ue.tst.eu/325b6ba70b1abe814dc6a5cb6c02730e.txt

The effect of syncfs was to make I/O a lot more "chunky" - first everything
was read, then everything was written (dstat output, btw., this is 1 second
intervals as always, but I never mentioned it - sorry):

http://ue.tst.eu/9a552a4f41a4863133d3eceb90f1ec87.txt

Without it, read and write happen "at the same time" (when sampled with 1
second intervals).

This increased the average throughput considerably, from around 45MB
read+write/s to 66MB/s. Whether this actually increased the GC process at
all I don't know, because syncfs of course forces a sync on the fs, with
its own overhead.

So while this is a rather heavy-handed approach, the major result was that
the amount of dirty pages is notably reduced (it never reaches 1GB), and
the box is much more usable during this time.

Right now, after about 9 hours, I am at "Dirty: 44k", and will start
writing to the device soon.

In any case, it seems f2fs seems to hold up quite nicely near disk full
conditions, and does recover nicely as well.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp@schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

------------------------------------------------------------------------------

  reply	other threads:[~2015-10-05  7:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04 12:49 more gc experiences Marc Lehmann
2015-10-05  7:25 ` Marc Lehmann [this message]
2015-10-05 15:02   ` more gc / gc script refinements Chao Yu
2015-10-05 23:16     ` Jaegeuk Kim
2015-10-06 16:41       ` Chao Yu
2015-10-06 23:44         ` Jaegeuk Kim
2015-10-07 12:32           ` Chao Yu

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=20151005072548.GA2504@schmorp.de \
    --to=schmorp@schmorp.de \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.