[dpdk-dev] [PATCH] mem: get physical address of any pointer
Olivier MATZ
olivier.matz at 6wind.com
Wed Jun 12 13:54:35 CEST 2013
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
More information about the dev
mailing list