DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Cc: echaudro@redhat.com, aconole@redhat.com, stable@dpdk.org,
	Andrea Arcangeli <aarcange@redhat.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA
Date: Mon, 9 Mar 2020 16:27:13 +0100	[thread overview]
Message-ID: <19294044-1f4e-84b0-6444-b504123b0827@redhat.com> (raw)
In-Reply-To: <20200309145442.28926-1-david.marchand@redhat.com>



On 3/9/20 3:54 PM, David Marchand wrote:
> When the memory allocator reserves virtual addresses, it still does not
> know what they will be used for.
> Besides, huge areas are reserved for memory hotplug in multiprocess
> setups. But most of the pages are unused in the whole life of the
> processes.
> 
> Change protection mode to PROT_NONE when only reserving VA.
> The memory allocator already switches to the right mode when making use
> of it.
> 
> It also has the nice effect of getting those pages skipped by the kernel
> when calling mlockall() or when a coredump gets generated.
> 
> Cc: stable@dpdk.org
> 
> Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/librte_eal/common/eal_common_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
> index 4a9cc1f19..cc7d54e0c 100644
> --- a/lib/librte_eal/common/eal_common_memory.c
> +++ b/lib/librte_eal/common/eal_common_memory.c
> @@ -97,7 +97,7 @@ eal_get_virtual_area(void *requested_addr, size_t *size,
>  			return NULL;
>  		}
>  
> -		mapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_READ,
> +		mapped_addr = mmap(requested_addr, (size_t)map_sz, PROT_NONE,
>  				mmap_flags, -1, 0);
>  		if (mapped_addr == MAP_FAILED && allow_shrink)
>  			*size -= page_sz;
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks!
Maxime


  reply	other threads:[~2020-03-09 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 14:54 David Marchand
2020-03-09 15:27 ` Maxime Coquelin [this message]
2020-03-10 13:57 ` Aaron Conole
2020-03-10 16:26 ` Burakov, Anatoly
2020-03-13  9:59 ` [dpdk-dev] [dpdk-stable] " David Marchand

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=19294044-1f4e-84b0-6444-b504123b0827@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=aconole@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=echaudro@redhat.com \
    --cc=stable@dpdk.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;
as well as URLs for NNTP newsgroup(s).