linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Rausch <gerd.rausch@oracle.com>
To: linux-mm@kvack.org
Cc: Aron Silverton <aron.silverton@oracle.com>,
	Chuck Lever III <chuck.lever@oracle.com>
Subject: Access to "vma_kernel_pagesize" from user-space
Date: Mon, 14 Nov 2022 11:07:14 -0800	[thread overview]
Message-ID: <7a2e46c8-7430-72f7-70ba-9a4ed8a3d6fa@oracle.com> (raw)

Hi,

I'm hoping this is the right forum to ask the following question:

libibverbs uses "madvise(MADV_DONTFORK)" on memory that
was previously registered with "ib_reg_mr".

With hugetlb support (environment variable "RDMAV_HUGEPAGES_SAFE" set),
libibverbs parses "/proc/self/smaps" looking for the virtual-address in question
to determine the proper page-size,
ultimately calling "vma_kernel_pagesize" -> "hugetlb_vm_op_pagesize".

Obviously, parsing "/proc/self/smaps" is rather slow with large processes
that contain many VMAs.

Question is: How to make this faster?

One InfiniBand-specific way out is to create a sysfs entry,
e.g. "/sys/class/infiniband_verbs/vma_pagesize"
and provide an interface (e.g. ioctl) that gives libiverbs the same
information, just a tad faster than parsing "/proc/self/smaps".

But getting access to "vma_kernel_pagesize" is something that is hardly
InfiniBand specific, and perhaps there are other applications/libraries
out there (if not today, perhaps tomorrow) that would like to do the same.

A generic interface from user-space to "vma_kernel_pagesize"
(other than parsing /proc/self/smaps) could have potential benefit.

But which API exactly?

For that I'm seeking input from this forum.

Thanks,

   Gerd


                 reply	other threads:[~2022-11-14 19:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7a2e46c8-7430-72f7-70ba-9a4ed8a3d6fa@oracle.com \
    --to=gerd.rausch@oracle.com \
    --cc=aron.silverton@oracle.com \
    --cc=chuck.lever@oracle.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