linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Adam Turowski <adam.s.turowski@gmail.com>
Cc: linux-mm@kvack.org
Subject: Re: How to mmap any address space using huge pages?
Date: Sat, 16 Oct 2021 12:50:26 -0300	[thread overview]
Message-ID: <20211016155026.GB3686969@ziepe.ca> (raw)
In-Reply-To: <CAPmneKm_v4wS3A55hDa-ib1Fo0ZWoZNk+vXn9RtSKpq6ObW9Ew@mail.gmail.com>

On Sat, Oct 16, 2021 at 11:46:59AM +0200, Adam Turowski wrote:
> Hello all,
> I have a device and I need to mmap it into a user space using 1GB huge
> pages. AFAIK I cannot use HugeTLB nor THP because they're backed by the
> memory. The remap_pfn_range doesn't use huge pages neither. So I used a
> huge_fault handler to set up the pud descriptor myself (arm64 here, so no
> transparent puds) and that works. The problem is that the kernel warns
> about a bad pud when the vma mapping is removed, the zap_pud_range function
> doesn't accept block puds. The vunmap_pud_range function works with block
> puds and checks for their presence and calls the pud_clear_huge function.
> If I add this function call to the zap_pud_range function, the warnings are
> gone.
> 
> Am I missing something? What is the proper way to mmap (and munmap) any
> address space using huge pages (esp. 1GB pages)?

AFAIK it can't be done today.

Certainly non-struct page memory cannot be installed in a PUD

If you create a ZONE_DEVICE struct page using memremap_pages() then
they can be inserted using vmf_insert_pfn_pud() - however that
requires arch support for pud_devmap() which only x86 does right now.

Jason


  reply	other threads:[~2021-10-16 15:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16  9:46 Adam Turowski
2021-10-16 15:50 ` Jason Gunthorpe [this message]
2021-10-18 10:14   ` Adam Turowski

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=20211016155026.GB3686969@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=adam.s.turowski@gmail.com \
    --cc=linux-mm@kvack.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