From patchwork Mon Oct 2 10:01:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 29471 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 151DB1B1F7; Mon, 2 Oct 2017 12:01:23 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id A8A671B1F4 for ; Mon, 2 Oct 2017 12:01:21 +0200 (CEST) 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 mx1.redhat.com (Postfix) with ESMTPS id D38D3C04AC58; Mon, 2 Oct 2017 10:01:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D38D3C04AC58 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=echaudro@redhat.com Received: from rhvm.com (ovpn-116-148.ams2.redhat.com [10.36.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B2C15C88B; Mon, 2 Oct 2017 10:01:20 +0000 (UTC) From: Eelco Chaudron To: john.mcnamara@intel.com Cc: dev@dpdk.org Date: Mon, 2 Oct 2017 12:01:40 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Oct 2017 10:01:21 +0000 (UTC) Subject: [dpdk-dev] [PATCH v2] doc: add use of mlockall to programmers guide 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 I was adding mlockall() to the testpmd application it was suggested to add a reference to the use case of mlockall(). This patch adds is. Signed-off-by: Eelco Chaudron Acked-by: John McNamara --- doc/guides/prog_guide/writing_efficient_code.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/guides/prog_guide/writing_efficient_code.rst b/doc/guides/prog_guide/writing_efficient_code.rst index 8223aceea..d7ac6778b 100644 --- a/doc/guides/prog_guide/writing_efficient_code.rst +++ b/doc/guides/prog_guide/writing_efficient_code.rst @@ -105,6 +105,21 @@ meaning that if all memory access operations are done on the first channel only, By default, the :ref:`Mempool Library ` spreads the addresses of objects among memory channels. +Locking memory pages +~~~~~~~~~~~~~~~~~~~~ + +The underlying operating system is allowed to load/unload memory pages at its own discretion. +These page loads could impact the performance, as the process is on hold when the kernel fetches them. + +To avoid these you could pre-load, and lock them into memory with the ``mlockall()`` call. + +.. code-block:: c + + if (mlockall(MCL_CURRENT | MCL_FUTURE)) { + RTE_LOG(NOTICE, USER1, "mlockall() failed with error \"%s\"\n", + strerror(errno)); + } + Communication Between lcores ----------------------------