From: Olivier MATZ <olivier.matz@6wind.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] mem: get physical address of any pointer
Date: Wed, 12 Jun 2013 13:54:35 +0200 [thread overview]
Message-ID: <51B8617B.7000009@6wind.com> (raw)
In-Reply-To: <1371023420-23195-1-git-send-email-thomas.monjalon@6wind.com>
Hi Thomas,
Please find some comments below.
> +/**
> + * Get physical address of any mapped virtual address in the current
process.
> + * It is found by browsing the /proc/self/pagemap special file.
> + * The page won't be swappable anymore.
> + */
> +phys_addr_t rte_mem_virt2phy(const void *virt);
>
> [...]
> -static int
> -find_physaddr(struct hugepage *hugepg_tbl, struct hugepage_info *hpi)
> +phys_addr_t
> +rte_mem_virt2phy(const void *virt)
> {
> [...]
> + /* allocate page in physical memory and prevent from swapping */
> + mlock((void*)aligned, page_size);
Should this function really do the mlock() ?
It's a bit confusing to have a function that looks like a "get"
that will change the status of the page.
Another approach that sounds more reasonnable to me is to let the
application does the mlock(), and have the rte_mem_virt2phy() return
RTE_BAD_PHYS_ADDR if the page is not locked in memory. This info
is well known from the /proc/self/pagemap.
Should we also rename virt2phy in virt2phys ?
Regards,
Olivier
next prev parent reply other threads:[~2013-06-12 11:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 7:50 Thomas Monjalon
2013-06-12 11:54 ` Olivier MATZ [this message]
2013-06-12 15:24 ` Thomas Monjalon
2013-06-12 15:35 ` Olivier MATZ
2013-06-12 15:42 ` Thomas Monjalon
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=51B8617B.7000009@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).