mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lizhe.67@bytedance.com" <lizhe.67@bytedance.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [GIT PULL] VFIO updates for v6.17-rc1
Date: Tue, 5 Aug 2025 15:37:43 +0200	[thread overview]
Message-ID: <623c315b-b64a-4bb0-a5d6-e3a2011aa55a@redhat.com> (raw)
In-Reply-To: <CAHk-=wgX3VMxQM7ohrPX5sHnxM2S9R1_C5PWNBAHYCb0H0CW8w@mail.gmail.com>

On 05.08.25 15:28, Linus Torvalds wrote:
> On Tue, 5 Aug 2025 at 16:20, David Hildenbrand <david@redhat.com> wrote:
>>
>> I think that would work, and we could limit the section check to the
>> problematic case only (sparsemem without VMEMMAP).
> 
> We really don't need to, because unlike the nth_page() thing, the
> compiler can see the logic and see "it's always zero".

Yeah, realized that later.

> 
> And in the complex case (ie actual sparsemem without VMEMMAP), the
> page_section() test is at least trivial, unlike the whole "turn it
> into a pfn and back".
> 
> Because that "turn it into a pfn and back" is actually a really quite
> complicated operation (and the compiler won't be able to optimize that
> one much, so I'm pretty sure it generates horrific code).

Yes, that's why I hate folio_page_idx() so much on !VMEMMAP

#define folio_page_idx(folio, p)	(page_to_pfn(p) - folio_pfn(folio))

> 
> I wish we didn't have nth_page() at all. I really don't think it's a
> valid operation. It's been around forever, but I think it was broken
> as introduced, exactly because I don't think you can validly even have
> allocations that cross section boundaries.

Ordinary buddy allocations cannot exceed a memory section, but hugetlb and
dax can with gigantic folios ... :(

We had some weird bugs with that, because people keep forgetting that you
cannot just use page++ unconditionally with such folios.

Anyhow, thanks Linus!

-- 
Cheers,

David / dhildenb


  reply	other threads:[~2025-08-05 13:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 22:22 Alex Williamson
2025-08-04 23:55 ` Linus Torvalds
2025-08-05  0:53   ` Alex Williamson
2025-08-05  7:47     ` David Hildenbrand
2025-08-05 11:49       ` Jason Gunthorpe
2025-08-05 12:07         ` David Hildenbrand
2025-08-05 12:38           ` Jason Gunthorpe
2025-08-05 12:41             ` David Hildenbrand
2025-08-05 12:56               ` Jason Gunthorpe
2025-08-05 13:05                 ` David Hildenbrand
2025-08-05 13:15                   ` Linus Torvalds
2025-08-05 13:19                     ` David Hildenbrand
2025-08-05 13:22                     ` David Hildenbrand
2025-08-05 13:00       ` Linus Torvalds
2025-08-05 13:20         ` David Hildenbrand
2025-08-05 13:24           ` David Hildenbrand
2025-08-05 13:28           ` Linus Torvalds
2025-08-05 13:37             ` David Hildenbrand [this message]
2025-08-05 13:49               ` Linus Torvalds
2025-08-05 13:25         ` Jason Gunthorpe
2025-08-05 13:33           ` David Hildenbrand
2025-08-05 13:55             ` Jason Gunthorpe
2025-08-05 14:10               ` David Hildenbrand
2025-08-05 14:20                 ` Jason Gunthorpe
2025-08-05 14:22                   ` David Hildenbrand
2025-08-05 14:24                     ` Jason Gunthorpe
2025-08-05 14:26                       ` David Hildenbrand
2025-08-05 13:36           ` Linus Torvalds
2025-08-05 13:47             ` David Hildenbrand
2025-08-05 13:51               ` Linus Torvalds
2025-08-05 13:55                 ` David Hildenbrand

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=623c315b-b64a-4bb0-a5d6-e3a2011aa55a@redhat.com \
    --to=david@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhe.67@bytedance.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®