linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kiryl Shutsemau <kirill@shutemov.name>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	 Luis Chamberlain <mcgrof@kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: Optimizing small reads
Date: Fri, 3 Oct 2025 18:23:31 +0100	[thread overview]
Message-ID: <a3nryktlvr6raisphhw56mdkvff6zr5athu2bsyiotrtkjchf3@z6rdwygtybft> (raw)
In-Reply-To: <CAHk-=whThZaXqDdum21SEWXjKQXmBcFN8E5zStX8W-EMEhAFdQ@mail.gmail.com>

On Fri, Oct 03, 2025 at 09:40:17AM -0700, Linus Torvalds wrote:
> On Fri, 3 Oct 2025 at 09:18, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > That was one of the theories and it might be the right one. There was
> > some discussion about having a sequence number. It's a long time ago,
> > I forget.
> 
> Ok, this bothered me. So I went back.
> 
> Damn. I actually mentioned that in the original submission (well,
> actually the reply after I had booted into it [1]):
> 
>  "And even then there's the question about replacing the same folio in
>   the same spot in the xarray. I'm not convinced it is worth worrying
>   about in any reality we care about, but it's _technically_ all a bit
>   wrong"
> 
> but then I left it because I was hoping somebody else would deal with it.
> 
> And I brought up the patch again several months later, but by then I
> had obviously repressed that issue.
> 
> So yeah, I think that's it, and I even knew about it originally, but
> in my incompetence I had entirely forgotten.
> 
> And by "that's it", I obviously mean that there might be something
> else going on too.
> 
> How about a sequence number in 'struct address_space' that gets
> incremented by removing folios?
> 
> Or even in 'struct xarray': it would always be protected by xa_lock,
> so it doesn't even need any new atomicity...

We would need a new barriers to serialize the sequence number against
removing folio from the tree, but it should be okay.

One thing that gave me pause is that we free folio while xa_lock is
still held (in __folio_split()), but it should be fine as long as do not
re-allocate it back under the same lock. It is very unlikely as xa_lock
is spinlock_t and would require GFP_ATOMIC.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov


  reply	other threads:[~2025-10-03 17:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03  2:18 Linus Torvalds
2025-10-03  3:32 ` Luis Chamberlain
2025-10-15 21:31   ` Swarna Prabhu
2025-10-03  9:55 ` Kiryl Shutsemau
2025-10-03 16:18   ` Linus Torvalds
2025-10-03 16:40     ` Linus Torvalds
2025-10-03 17:23       ` Kiryl Shutsemau [this message]
2025-10-03 17:49         ` Linus Torvalds
2025-10-06 11:44           ` Kiryl Shutsemau
2025-10-06 15:50             ` Linus Torvalds
2025-10-06 18:04               ` Kiryl Shutsemau
2025-10-06 18:14                 ` Linus Torvalds
2025-10-07 21:47                 ` Linus Torvalds
2025-10-07 22:35                   ` Linus Torvalds
2025-10-07 22:54                     ` Linus Torvalds
2025-10-07 23:30                       ` Linus Torvalds
2025-10-08 14:54                         ` Kiryl Shutsemau
2025-10-08 16:27                           ` Linus Torvalds
2025-10-08 17:03                             ` Linus Torvalds
2025-10-09 16:22                               ` Kiryl Shutsemau
2025-10-09 17:29                                 ` Linus Torvalds
2025-10-10 10:10                                   ` Kiryl Shutsemau
2025-10-10 17:51                                     ` Linus Torvalds
2025-10-13 15:35                                       ` Kiryl Shutsemau
2025-10-13 15:39                                         ` Kiryl Shutsemau
2025-10-13 16:19                                           ` Linus Torvalds
2025-10-14 12:58                                             ` Kiryl Shutsemau
2025-10-14 16:41                                               ` Linus Torvalds
2025-10-13 16:06                                         ` Linus Torvalds
2025-10-13 17:26                                         ` Theodore Ts'o
2025-10-14  3:20                                           ` Theodore Ts'o
2025-10-08 10:28                       ` Kiryl Shutsemau
2025-10-08 16:24                         ` Linus Torvalds

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=a3nryktlvr6raisphhw56mdkvff6zr5athu2bsyiotrtkjchf3@z6rdwygtybft \
    --to=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=mcgrof@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.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