Thanks for the confirmation. 
I am using remap_pfn_range(). I can use alloc_pages() instead of kmalloc().

On Thu, Apr 25, 2024 at 3:06 PM David Hildenbrand <david@redhat.com> wrote:
On 25.04.24 11:21, Mounesh Badiger wrote:
> Hi,

Hi,

>
> We have a device driver that allocates physical pages using kmalloc()
> and these pages are mapped to the userspace process via mmap.

Which interface are you using for inserting these pages into the page
tables?

remap_pfn_range? vm_insert_page() ? ...

Using kmalloc sound weird ... why not simply alloc_pages()?

>
> Does the kmalloc()'ed memory mapped to userspace can migrate or get
> remapped due to any of kernel mm operations?

No.

>
> we are looking to keep VA->PA mapping intact from a
> userspace process point of view.

That will work.

--
Cheers,

David / dhildenb



--
Mounesh Badiger
Support for education
Visit: www.vidyaposhak.org