All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Carlos Maiolino <cem@kernel.org>,
	Hans Holmberg <hans.holmberg@wdc.com>, Chris Mason <clm@meta.com>,
	Keith Busch <kbusch@kernel.org>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: use a seprate member to track space availabe in the GC scatch buffer
Date: Wed, 28 Jan 2026 06:52:57 +0100	[thread overview]
Message-ID: <20260128055257.GA1835@lst.de> (raw)
In-Reply-To: <20260128053511.GR5945@frogsfrogsfrogs>

On Tue, Jan 27, 2026 at 09:35:11PM -0800, Darrick J. Wong wrote:
> > +	unsigned int			scratch_available;
> >  	unsigned int			scratch_head;
> >  	unsigned int			scratch_tail;
> 
> Hrm.  I did some digging (because clearly I'm not that good at
> ringbuffer) and came up with this gem from akpm:
> 
> "A circular buffer implementation needs only head and tail indices.
> `size' above appears to be redundant.
> 
> "Implementation-wise, the head and tail indices should *not* be
> constrained to be less than the size of the buffer. They should be
> allowed to wrap all the way back to zero. This allows you to distinguish
> between the completely-empty and completely-full states while using 100%
> of the storage."
> 
> https://lkml.iu.edu/hypermail/linux/kernel/0409.1/2709.html
> 
> Can that apply here?

It could, see the version Keith posted.  But this one is actually
slightly simpler, while the unsigned overlflow version requires saves 4
bytes of memory per file system (+/- 4 bytes of padding for either
version which I haven't checked) and a single add and sub instruction
each for every GC operation.

My preference is this simpler version, but the other one should work
just fine as well.


  reply	other threads:[~2026-01-28  5:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 15:10 zone GC ringbuffer fix and cleanup Christoph Hellwig
2026-01-27 15:10 ` [PATCH 1/2] xfs: use a seprate member to track space availabe in the GC scatch buffer Christoph Hellwig
2026-01-28  5:35   ` Darrick J. Wong
2026-01-28  5:52     ` Christoph Hellwig [this message]
2026-01-28  5:56   ` Christoph Hellwig
2026-01-28 10:09     ` Carlos Maiolino
2026-01-28 12:00   ` Hans Holmberg
2026-01-29 11:32   ` Carlos Maiolino
2026-01-27 15:10 ` [PATCH 2/2] xfs: remove xfs_zone_gc_space_available Christoph Hellwig
2026-01-28 12:02   ` Hans Holmberg
2026-01-27 15:25 ` zone GC ringbuffer fix and cleanup Keith Busch

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=20260128055257.GA1835@lst.de \
    --to=hch@lst.de \
    --cc=cem@kernel.org \
    --cc=clm@meta.com \
    --cc=djwong@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=kbusch@kernel.org \
    --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.