All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: sunil bhargo <marx_bhargav@yahoo.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: "mounesh.b@gmail.com" <mounesh.b@gmail.com>
Subject: Re: Request for clarification regarding huge pages and remapping of virtual to physical address
Date: Wed, 17 Apr 2024 11:17:24 +0200	[thread overview]
Message-ID: <fd8973aa-4936-4114-9baa-6319f048dc15@redhat.com> (raw)
In-Reply-To: <245378552.87900.1713345083646@mail.yahoo.com>

On 17.04.24 11:11, sunil bhargo wrote:
> Hi,
> 
> We have an application which relies on virtual address to physical 
> address mapping to remain static. The buffer is allocated using 
> malloc. It is in user space and we were using the mlock thinking that as 
> it would prevent the swapping the va->pa address mapping would be 
> static. But it seems to be a faulty assumption.
> 
> If the memory is allocated from huge pages by reserving space upfront at 
> the kernel boot up and then mmap’ing using MAP_HUGETLB, is it assured 
> that virtual address to physical mapping won’t be remapped and will be 
> static ?

Unless you have a kernel that has page migration disabled, no.

You could use secretmem (which is currently not migratabale/swappable/ 
...), but that has very limited capabilities.

A "hack" would be to register that (ordinary) memory using iouring as a 
fixed buffer. That way, it will be longterm pinned and can neither get 
migrated nor swapped out.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-04-17  9:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <245378552.87900.1713345083646.ref@mail.yahoo.com>
2024-04-17  9:11 ` Request for clarification regarding huge pages and remapping of virtual to physical address sunil bhargo
2024-04-17  9:17   ` David Hildenbrand [this message]
2024-04-17 10:09     ` sunil bhargo
2024-04-17 15:00       ` 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=fd8973aa-4936-4114-9baa-6319f048dc15@redhat.com \
    --to=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=marx_bhargav@yahoo.com \
    --cc=mounesh.b@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.