linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Boris Burkov <boris@bur.io>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: XArray multiple marks support
Date: Tue, 5 Jul 2022 19:38:53 +0100	[thread overview]
Message-ID: <YsSFPXR4SYlHiQaI@casper.infradead.org> (raw)
In-Reply-To: <YsR8h34aNzHiS3EY@zen>

On Tue, Jul 05, 2022 at 11:01:43AM -0700, Boris Burkov wrote:
> > Unfortunately, I don't think doing this will work out really well for
> > you.  The bits really are independent of each other, and the power of
> > the search marks lies in their ability to skip over vast swathes of
> > the array when they're not marked.  But to do what you want, we'd end up
> > doing something like this:
> > 
> > leaf array 1:
> >   entry 0 is in category 1
> >   entry 1 is in category 2
> >   entry 2 is in category 5
> > 
> > and now we have to set all three bits in the parent of leaf array 1,
> > so any search will have to traverse all of leaf array 1 in order to find
> > out whether there are any entries in the category we're looking for.
> 
> Thank you for the explanation. To check my understanding, does this
> point also imply that currently the worst case for marked search is if
> every leaf array has an entry with each mark set?

Yes.  Each leaf array is 64 entries, and the tags are stored at the end
of the node.  A mark search consists of scanning one of the three
bitmaps.  Which means we have to load two cachelines (both the header
and the mark array) out of each node which has a mark set.  We can
avoid accessing six or seven of the nine cachelines if only one
bit is set, but with the amount of prefetching CPUs do these days,
I don't know how effective that is.

I keep meaning to try moving the mark array from the end of the
node to the header, but I worry it'll hurt non-marked lookups.

      reply	other threads:[~2022-07-05 18:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 15:48 XArray multiple marks support Boris Burkov
2022-07-04 22:32 ` Matthew Wilcox
2022-07-05 18:01   ` Boris Burkov
2022-07-05 18:38     ` Matthew Wilcox [this message]

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=YsSFPXR4SYlHiQaI@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=boris@bur.io \
    --cc=linux-fsdevel@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 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).