From patchwork Fri Sep 29 12:50:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 29431 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 CF30F5592; Fri, 29 Sep 2017 14:50:37 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F1BF5FFA for ; Fri, 29 Sep 2017 14:50:36 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 390454E34A; Fri, 29 Sep 2017 12:50:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 390454E34A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=echaudro@redhat.com Received: from rhvm.com (ovpn-116-180.ams2.redhat.com [10.36.116.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8411353CF6; Fri, 29 Sep 2017 12:50:35 +0000 (UTC) From: Eelco Chaudron To: john.mcnamara@intel.com Cc: dev@dpdk.org Date: Fri, 29 Sep 2017 14:50:45 +0200 Message-Id: <138d85856e7b5c6c09abfccdb885927458120be8.1506689397.git.echaudro@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 29 Sep 2017 12:50:36 +0000 (UTC) Subject: [dpdk-dev] [PATCH] doc: Adds reference to use mlockall() in the Programmer's 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(). Signed-off-by: Eelco Chaudron Reviewed-by: John McNamara --- doc/guides/prog_guide/writing_efficient_code.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/guides/prog_guide/writing_efficient_code.rst b/doc/guides/prog_guide/writing_efficient_code.rst index 8223aceea..3975026ce 100644 --- a/doc/guides/prog_guide/writing_efficient_code.rst +++ b/doc/guides/prog_guide/writing_efficient_code.rst @@ -105,6 +105,20 @@ 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 ----------------------------