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 BAFF9A052E for ; Mon, 9 Mar 2020 15:55:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8848C1C08E; Mon, 9 Mar 2020 15:55:40 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 43C5E1C08E for ; Mon, 9 Mar 2020 15:55:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583765738; 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=jKR1qp7fO708wohLXpR9JNOEYm9+HIqPIl7OtEyNsM7b5baLJmUP9vfVi4DT3zhfpvx3/L 5lo3+e5sgol7489H0CQvhLzngUBbfZeLGPoK46OvfK8lVNrlFxa33xtRvgbgDuZfkPYQfQ yqdjZmT0rah9z4+ojKAJSqXxBmIdIsg= 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-stable] [PATCH] mem: mark pages as not accessed when reserving VA X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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