From: Mark Tinguely <tinguely@sgi.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: optimise CIL insertion during transaction commit [RFC]
Date: Wed, 03 Jul 2013 21:09:10 -0500 [thread overview]
Message-ID: <51D4D946.70409@sgi.com> (raw)
In-Reply-To: <1372657476-9241-1-git-send-email-david@fromorbit.com>
On 07/01/13 00:44, Dave Chinner wrote:
> From: Dave Chinner<dchinner@redhat.com>
>
> Note: This is an RFC right now - it'll need to be broken up into
> several patches for final submission.
>
> The CIL insertion during transaction commit currently does multiple
> passes across the transaction objects and requires multiple memory
> allocations per object that is to be inserted into the CIL. It is
> quite inefficient, and as such xfs_log_commit_cil() and it's
> children show up quite highly in profiles under metadata
> modification intensive workloads.
>
> The current insertion tries to minimise ithe number of times the
> xc_cil_lock is grabbed and the hold times via a couple of methods:
>
> 1. an initial loop across the transaction items outside the
> lock to allocate log vectors, buffers and copy the data into
> them.
> 2. a second pass across the log vectors that then inserts
> them into the CIL, modifies the CIL state and frees the old
> vectors.
>
> This is somewhat inefficient. While it minimises lock grabs, the
> hold time is still quite high because we are freeing objects with
> the spinlock held and so the hold times are much higher than they
> need to be.
>
> Optimisations that can be made:
>
> 1. change IOP_SIZE() to return the size of the metadata to
> be logged with the number of vectors required. This means we
> can allocate the buffer to hold the metadata as part of the
> allocation for the log vector array. Once allocation instead
> of two.
>
> 2. Store the size of the allocated region for the log vector
> in the log vector itself. This allows us to determine if we
> can just reuse the existing log vector for the new
> transactions. Avoids all memory allocation for that item.
>
> 3. when setting up a new log vector, we don't need to
> hold the CIL lock while determining the difference in it's
> size when compared to the old one. Hence we can do all the
> accounting, swapping of the log vectors and freeing the old
> log vectors outside the xc_cil_lock.
>
> 4. We can do all the CIL insertation of items and busy
> extents and the accounting under a single grab of the
> xc_cil_lock. This minimises the number of times we need to
> grab it and hence contention points are kept to a minimum
>
> 5. the xc_cil_lock is used for serialising both the CIL and
> the push/commit ordering. Separate the two functions into
> different locks so push/commit ordering does not affect CIL
> insertion
>
> 6. the xc_cil_lock shares cachelines with other locks.
> Separate them onto different cachelines.
>
> The result is that my standard fsmark benchmark (8-way, 50m files)
> on my standard test VM (8-way, 4GB RAM, 4xSSD in RAID0, 100TB fs)
> gives the following results with a xfs-oss tree. No CRCs:
>
> vanilla patched Difference
> create (time) 483s 435s -10.0% (faster)
> (rate) 109k+/6k 122k+/-7k +11.9% (faster)
>
> walk 339s 335s (noise)
> (sys cpu) 1134s 1135s (noise)
>
> unlink 692s 645s -6.8% (faster)
>
> So it's significantly faster than the current code, and lock_stat
> reports lower contention on the xc_cil_lock, too. So, big win here.
>
> With CRCs:
>
> vanilla patched Difference
> create (time) 510s 460s -9.8% (faster)
> (rate) 105k+/5.4k 117k+/-5k +11.4% (faster)
>
> walk 494s 486s (noise)
> (sys cpu) 1324s 1290s (noise)
>
> unlink 959s 889s -7.3% (faster)
>
> Gains are of the same order, with walk and unlink still affected by
> VFS LRU lock contention. IOWs, with this changes, filesystems with
> CRCs enabled will still be faster than the old non-CRC kernels...
>
> Signed-off-by: Dave Chinner<dchinner@redhat.com>
Dave,
The idea to separate the transaction commits from the CIL push looks good.
I am still concerned that the xc_ctx->space_used comparison to
XLOG_CIL_SPACE_LIMIT(log) does not also contain any information on
the "stolen" ticket log space. Maybe the future Liu/Chinner minimum
log space series is the best place to address this and my other log
space concerns.
--Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-07-04 2:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 5:44 [PATCH] xfs: optimise CIL insertion during transaction commit [RFC] Dave Chinner
2013-07-04 2:09 ` Mark Tinguely [this message]
2013-07-08 12:44 ` Some baseline tests on new hardware (was Re: [PATCH] xfs: optimise CIL insertion during transaction commit [RFC]) Dave Chinner
2013-07-08 12:44 ` Dave Chinner
2013-07-08 13:59 ` Jan Kara
2013-07-08 15:22 ` Marco Stornelli
2013-07-08 15:22 ` Marco Stornelli
2013-07-08 15:38 ` Jan Kara
2013-07-09 0:15 ` Dave Chinner
2013-07-09 0:15 ` Dave Chinner
2013-07-09 0:56 ` Theodore Ts'o
2013-07-09 0:56 ` Theodore Ts'o
2013-07-09 0:43 ` Zheng Liu
2013-07-09 0:43 ` Zheng Liu
2013-07-09 1:23 ` Dave Chinner
2013-07-09 1:23 ` Dave Chinner
2013-07-09 1:15 ` Chris Mason
2013-07-09 1:15 ` Chris Mason
2013-07-09 1:26 ` Dave Chinner
2013-07-09 1:54 ` [BULK] " Chris Mason
2013-07-09 1:54 ` Chris Mason
2013-07-09 8:26 ` Dave Chinner
2013-07-09 8:26 ` Dave Chinner
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=51D4D946.70409@sgi.com \
--to=tinguely@sgi.com \
--cc=david@fromorbit.com \
--cc=xfs@oss.sgi.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 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.