From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 10/11] xfs: grant heads track byte counts, not LSNs
Date: Mon, 1 Jul 2024 10:59:09 +1000 [thread overview]
Message-ID: <ZoH/XRnChpIYZEUH@dread.disaster.area> (raw)
In-Reply-To: <20240620072146.530267-11-hch@lst.de>
On Thu, Jun 20, 2024 at 09:21:27AM +0200, Christoph Hellwig wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The grant heads in the log track the space reserved in the log for
> running transactions. They do this by tracking how far ahead of the
> tail that the reservation has reached, and the units for doing this
> are {cycle,bytes} for the reserve head rather than {cycle,blocks}
> which are normal used by LSNs.
>
> This is annoyingly complex because we have to split, crack and
> combined these tuples for any calculation we do to determine log
> space and targets. This is computationally expensive as well as
> difficult to do atomically and locklessly, as well as limiting the
> size of the log to 2^32 bytes.
>
> Really, though, all the grant heads are tracking is how much space
> is currently available for use in the log. We can track this as a
> simply byte count - we just don't care what the actual physical
> location in the log the head and tail are at, just how much space we
> have remaining before the head and tail overlap.
>
> So, convert the grant heads to track the byte reservations that are
> active rather than the current (cycle, offset) tuples. This means an
> empty log has zero bytes consumed, and a full log is when the
> reservations reach the size of the log minus the space consumed by
> the AIL.
>
> This greatly simplifies the accounting and checks for whether there
> is space available. We no longer need to crack or combine LSNs to
> determine how much space the log has left, nor do we need to look at
> the head or tail of the log to determine how close to full we are.
>
> There is, however, a complexity that needs to be handled. We know
> how much space is being tracked in the AIL now via log->l_tail_space
> and the log tickets track active reservations and return the unused
> portions to the grant heads when ungranted. Unfortunately, we don't
> track the used portion of the grant, so when we transfer log items
> from the CIL to the AIL, the space accounted to the grant heads is
> transferred to the log tail space. Hence when we move the AIL head
> forwards on item insert, we have to remove that space from the grant
> heads.
>
> We also remove the xlog_verify_grant_tail() debug function as it is
> no longer useful. The check it performs has been racy since delayed
> logging was introduced, but now it is clearly only detecting false
> positives so remove it.
>
> The result of this substantially simpler accounting algorithm is an
> increase in sustained transaction rate from ~1.3 million
> transactions/s to ~1.9 million transactions/s with no increase in
> CPU usage. We also remove the 32 bit space limitation on the grant
> heads, which will allow us to increase the journal size beyond 2GB
> in future.
>
> Note that this renames the sysfs files exposing the log grant space
> now that the values are exported in bytes. This allows xfstests
> to auto-detect the old or new ABI.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> [hch: move xlog_grant_sub_space out of line,
> update the xlog_grant_{add,sub}_space prototypes,
> rename the sysfs files to allow auto-detection in xfstests]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Updates look fine.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2024-07-01 0:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 7:21 xfs: byte-based grant head reservation tracking v4 Christoph Hellwig
2024-06-20 7:21 ` [PATCH 01/11] xfs: fix the contact address for the sysfs ABI documentation Christoph Hellwig
2024-06-20 15:20 ` Darrick J. Wong
2024-06-20 7:21 ` [PATCH 02/11] xfs: move and rename xfs_trans_committed_bulk Christoph Hellwig
2024-06-20 7:21 ` [PATCH 03/11] xfs: AIL doesn't need manual pushing Christoph Hellwig
2024-06-20 19:01 ` Darrick J. Wong
2024-06-20 7:21 ` [PATCH 04/11] xfs: background AIL push should target physical space Christoph Hellwig
2024-06-20 19:42 ` Darrick J. Wong
2024-06-21 5:37 ` Christoph Hellwig
2024-06-21 16:18 ` Darrick J. Wong
2024-06-20 7:21 ` [PATCH 05/11] xfs: ensure log tail is always up to date Christoph Hellwig
2024-06-20 7:21 ` [PATCH 06/11] xfs: l_last_sync_lsn is really AIL state Christoph Hellwig
2024-06-20 7:21 ` [PATCH 07/11] xfs: collapse xlog_state_set_callback in caller Christoph Hellwig
2024-06-20 7:21 ` [PATCH 08/11] xfs: track log space pinned by the AIL Christoph Hellwig
2024-06-20 7:21 ` [PATCH 09/11] xfs: pass the full grant head to accounting functions Christoph Hellwig
2024-06-20 7:21 ` [PATCH 10/11] xfs: grant heads track byte counts, not LSNs Christoph Hellwig
2024-07-01 0:59 ` Dave Chinner [this message]
2024-06-20 7:21 ` [PATCH 11/11] xfs: skip flushing log items during push Christoph Hellwig
2024-06-20 19:51 ` Darrick J. Wong
2024-06-21 5:48 ` Christoph Hellwig
2024-06-21 17:46 ` Darrick J. Wong
2024-07-02 18:51 ` Darrick J. Wong
2024-07-02 23:29 ` Dave Chinner
2024-07-03 5:10 ` Darrick J. Wong
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=ZoH/XRnChpIYZEUH@dread.disaster.area \
--to=david@fromorbit.com \
--cc=chandan.babu@oracle.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/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.