From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E3BAA052E; Mon, 9 Mar 2020 15:55:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6EA51C08E; Mon, 9 Mar 2020 15:55:42 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 359AA1C0B3 for ; Mon, 9 Mar 2020 15:55:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583765740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jE+RjU9pOuVC1wqofvLSbIlQCdzPDgoOqxHknGMg/+8=; b=DyyLBMaFzX1abWNcEU6EMjpZfZD/GHDzYqLZc8p/1R6MRwfmRji8Y3T5glSChCKIxu4dyJ JBDEoAnz63znJonrtIB907VGUiPvs+hDE0fho4XtkHa3cE4SzVpbXC5DKXKd1rL8KMQgco sbRQlMU6Mqcaaayk9aqvENTmqB6Neas= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-SlIrKS3KPpC-a4ucKWQ8Lg-1; Mon, 09 Mar 2020 10:55:37 -0400 X-MC-Unique: SlIrKS3KPpC-a4ucKWQ8Lg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14D328017CC; Mon, 9 Mar 2020 14:55:36 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-36.brq.redhat.com [10.40.204.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E12865E80; Mon, 9 Mar 2020 14:55:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: echaudro@redhat.com, aconole@redhat.com, maxime.coquelin@redhat.com, stable@dpdk.org, Andrea Arcangeli , Anatoly Burakov Date: Mon, 9 Mar 2020 15:54:42 +0100 Message-Id: <20200309145442.28926-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH] mem: mark pages as not accessed when reserving VA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: David Marchand --- 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/com= mon/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, =09=09=09return NULL; =09=09} =20 -=09=09mapped_addr =3D mmap(requested_addr, (size_t)map_sz, PROT_READ, +=09=09mapped_addr =3D mmap(requested_addr, (size_t)map_sz, PROT_NONE, =09=09=09=09mmap_flags, -1, 0); =09=09if (mapped_addr =3D=3D MAP_FAILED && allow_shrink) =09=09=09*size -=3D page_sz; --=20 2.23.0