From: Christoph Hellwig <hch@infradead.org>
To: Robin Holt <holt@sgi.com>
Cc: linux-mm@kvack.org, Stephane Eranian <eranian@hpl.hp.com>
Subject: Re: What is the right way to prefault and pin pages for perfmon?
Date: Mon, 7 May 2007 13:20:52 +0100 [thread overview]
Message-ID: <20070507122052.GA1670@infradead.org> (raw)
In-Reply-To: <20070507114838.GD14010@lnx-holt.americas.sgi.com>
On Mon, May 07, 2007 at 06:48:38AM -0500, Robin Holt wrote:
> perfmon has a need to get memory allocated and prefaulted for a shared
> buffer between user and kernel. The memory is read-only to the user.
> The hardware performance counter values are inserted into those pages.
> Pages can not be faulted during sampling as we only have nano to micro
> seconds to capture the values with accuracy. What is the right way to
> accomplish this?
Allocate the pages using alloc_page and then insert it using vm_insert_page.
In case you need a contiguous mapping use vmap to establish it, but it
would be better if we could avoid that part to not eat up too much
vmalloc space.
Note that all this should happen from a ->mmap method and not from
other magic calls. Nothing but calls to mmap (or related syscalls)
should change the user address space.
> Currently, the user is calling the kernel with a number of sample entries
> for a single cpu's buffers. The kernel turns this into a buffer size
> and calls vmalloc to get a kernel virtually contiguous address range.
> It then sets PG_RESERVED on all those pages and calls remap_pfn_range()
> to insert page table entries into the users address space. Additionally,
> it is updating locked_vm on the tasks mm.
>
> I think this should really become do_mmap(), followed by get_user_pages().
Not at all. do_mmap is not something anyone but the various mmap
implementation should call. Having this function exported at all
is a tragic historic coincidence involving a few graphics hackers
and lots of illegal drugs.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2007-05-07 12:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-07 11:48 Robin Holt
2007-05-07 12:20 ` Christoph Hellwig [this message]
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=20070507122052.GA1670@infradead.org \
--to=hch@infradead.org \
--cc=eranian@hpl.hp.com \
--cc=holt@sgi.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