From: David Hildenbrand <david@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
"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>
Subject: Re: [GIT PULL] VFIO updates for v6.17-rc1
Date: Tue, 5 Aug 2025 15:05:22 +0200 [thread overview]
Message-ID: <a18a9b55-b3f0-466f-abc8-39b231c04bb1@redhat.com> (raw)
In-Reply-To: <20250805125643.GK184255@nvidia.com>
On 05.08.25 14:56, Jason Gunthorpe wrote:
> On Tue, Aug 05, 2025 at 02:41:38PM +0200, David Hildenbrand wrote:
>> On 05.08.25 14:38, Jason Gunthorpe wrote:
>>> On Tue, Aug 05, 2025 at 02:07:49PM +0200, David Hildenbrand wrote:
>>>> I don't see an easy way to guarantee that. E.g., populate_section_memmap
>>>> really just does a kvmalloc_node() and
>>>> __populate_section_memmap()->memmap_alloc() a memblock_alloc().
>>>
>>> Well, it is really easy, if you do the kvmalloc_node and you get the
>>> single unwanted struct page value, then call it again and free the
>>> first one. The second call is guarenteed to not return the unwanted
>>> value because the first call has it allocated.
>>
>> So you want to walk all existing sections to check that? :)
>
> We don't need to walk, compute the page-1 and carefully run that
> through page_to_pfn algorithm.
You have to test if first_page-1 and last_page+1 are used as the memmap
for another section.
So yeah, it could be done by some page_to_pfn + pfn_to_page trickery I
think.
Not that I would like that "allocate until you find something that
works" approach.
>
>> That's the kind of approach I would describe with the words Linus used.
>
> Its some small boot time nastyness, we do this all the time messing up
> the slow path so the fast paths can be simple
nth_page won't go away. If it would go away, I would be sold on almost
any idea. nth_page is the real problem.
So I don't like the idea of micro-optimizing num_pages_contiguous() by
adding weird tweaks to the core for that.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-08-05 13:05 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 [this message]
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
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=a18a9b55-b3f0-466f-abc8-39b231c04bb1@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®