From patchwork Fri Oct 7 10:35:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 77333 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp247583qge; Fri, 7 Oct 2016 02:43:40 -0700 (PDT) X-Received: by 10.36.73.232 with SMTP id e101mr31498020itd.119.1475833420277; Fri, 07 Oct 2016 02:43:40 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p138si21569520iod.102.2016.10.07.02.43.39; Fri, 07 Oct 2016 02:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A0E9760A49; Fri, 7 Oct 2016 09:43:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A205B6180C; Fri, 7 Oct 2016 09:37:06 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 10411617B7; Fri, 7 Oct 2016 09:36:38 +0000 (UTC) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by lists.linaro.org (Postfix) with ESMTPS id 76F0A617C4 for ; Fri, 7 Oct 2016 09:36:27 +0000 (UTC) Received: by mail-lf0-f49.google.com with SMTP id b75so36556726lfg.3 for ; Fri, 07 Oct 2016 02:36:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dS9lFInNa79lWmse8CNet544bDJ/q5zoTPhb6nyX0nE=; b=kE0c7ORM14ysIdULYjKiHKWuT1g5Q/x7zQYlOUCmXOekLUhG456Uyp57bgE40x0T0I GI3D/EBBENdQ9pksJBuqIAhfcOqR2zAdENaOBtZX98ulyOxaWcUmBQStY5fElSmj2JFc gzeK1PiQE8jA160W5wILe3cQ874LpywhRZS0lukg4WUSdPK3GPEx+k5CQzFV1Hpof6ks sh+9bPEUqB0+gPz1J1sE+QQU8jeiUsMUp+uWO0jxf9eG2BUgyLLz5l3/HBr47FMZ041P 93mN7VxnVc6DHkbt593TKOIuMasfyhX85W4N7113KEbMTeIIM487Gg30zlRqTTSkuFNE A7Jw== X-Gm-Message-State: AA6/9RnMglQD0lbfXZA2q8G197tVQXwwaCXYmQWGh8zHs4UJpe8WX1MH10B/YgHVQALqaq7so6c= X-Received: by 10.25.27.139 with SMTP id b133mr7131477lfb.157.1475832986225; Fri, 07 Oct 2016 02:36:26 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id 5sm3465255ljb.22.2016.10.07.02.36.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Oct 2016 02:36:25 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Fri, 7 Oct 2016 12:35:17 +0200 Message-Id: <1475836517-60484-15-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475836517-60484-1-git-send-email-christophe.milard@linaro.org> References: <1475836517-60484-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 14/14] linux_gen: _ishm: decreasing the number of error messages when no huge pages X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Christophe Milard --- platform/linux-generic/_ishm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index 11bb316..0c08998 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -427,8 +427,12 @@ static int create_file(int block_index, huge_flag_t huge, fd = open(filename, oflag, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { - ODP_ERR("open failed for %s: %s.\n", - filename, strerror(errno)); + if (huge == HUGE) + ODP_DBG("open failed for %s: %s.\n", + filename, strerror(errno)); + else + ODP_ERR("open failed for %s: %s.\n", + filename, strerror(errno)); return -1; } @@ -730,6 +734,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, void *addr = NULL; /* mapping address */ int new_proc_entry; struct stat statbuf; + static int huge_error_printed; /* to avoid millions of error...*/ odp_spinlock_lock(&ishm_tbl->lock); @@ -804,11 +809,16 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, len = (size + (page_hp_size - 1)) & (-page_hp_size); addr = do_map(new_index, len, hp_align, flags, HUGE, &fd); - if (addr == NULL) - ODP_DBG("No huge pages, fall back to normal pages, " - "check: /proc/sys/vm/nr_hugepages.\n"); - else + if (addr == NULL) { + if (!huge_error_printed) { + ODP_ERR("No huge pages, fall back to normal " + "pages. " + "check: /proc/sys/vm/nr_hugepages.\n"); + huge_error_printed = 1; + } + } else { new_block->huge = HUGE; + } } /* Try normal pages if huge pages failed */