DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA
@ 2020-03-09 14:54 David Marchand
  2020-03-09 15:27 ` Maxime Coquelin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Marchand @ 2020-03-09 14:54 UTC (permalink / raw)
  To: dev
  Cc: echaudro, aconole, maxime.coquelin, stable, Andrea Arcangeli,
	Anatoly Burakov

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;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA
  2020-03-09 14:54 [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA David Marchand
@ 2020-03-09 15:27 ` Maxime Coquelin
  2020-03-10 13:57 ` Aaron Conole
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2020-03-09 15:27 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: echaudro, aconole, stable, Andrea Arcangeli, Anatoly Burakov



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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA
  2020-03-09 14:54 [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA David Marchand
  2020-03-09 15:27 ` Maxime Coquelin
@ 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
  3 siblings, 0 replies; 5+ messages in thread
From: Aaron Conole @ 2020-03-10 13:57 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, echaudro, maxime.coquelin, stable, Andrea Arcangeli,
	Anatoly Burakov

David Marchand <david.marchand@redhat.com> writes:

> 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>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA
  2020-03-09 14:54 [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA David Marchand
  2020-03-09 15:27 ` Maxime Coquelin
  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
  3 siblings, 0 replies; 5+ messages in thread
From: Burakov, Anatoly @ 2020-03-10 16:26 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: echaudro, aconole, maxime.coquelin, stable, Andrea Arcangeli

On 09-Mar-20 2: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>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] mem: mark pages as not accessed when reserving VA
  2020-03-09 14:54 [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA David Marchand
                   ` (2 preceding siblings ...)
  2020-03-10 16:26 ` Burakov, Anatoly
@ 2020-03-13  9:59 ` David Marchand
  3 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2020-03-13  9:59 UTC (permalink / raw)
  To: dev
  Cc: Eelco Chaudron, Aaron Conole, Maxime Coquelin, dpdk stable,
	Andrea Arcangeli, Anatoly Burakov

On Mon, Mar 9, 2020 at 3:55 PM David Marchand <david.marchand@redhat.com> 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>

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>


Applied.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-13  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 14:54 [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA David Marchand
2020-03-09 15:27 ` Maxime Coquelin
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

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).