From patchwork Thu Nov 24 16:22:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 83943 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp225644obn; Thu, 24 Nov 2016 07:40:33 -0800 (PST) X-Received: by 10.237.36.114 with SMTP id s47mr2815135qtc.221.1480002033724; Thu, 24 Nov 2016 07:40:33 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m1si15389463qtd.80.2016.11.24.07.40.33; Thu, 24 Nov 2016 07:40:33 -0800 (PST) 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 5552462DDD; Thu, 24 Nov 2016 15:40:33 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 324EE62EBF; Thu, 24 Nov 2016 15:26:45 +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 1C2876087D; Thu, 24 Nov 2016 15:26:14 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id 70C2662DDC for ; Thu, 24 Nov 2016 15:23:11 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id o141so31130462lff.1 for ; Thu, 24 Nov 2016 07:23:11 -0800 (PST) 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=z7J2Lz/D7jqI/9F+xqs1IdQDAwloEygoN56WA4zKx3s=; b=UTEfLzyyjy+7MUhLr7otkB50ZcCor2LR/o1HMMCIz77O3lpmOW55gy6AKrPtWP1RXT wRKzfEx0yGNT4WPnGL5RP+zmuAFP+hmOv0eg3zZSJd8U3+wvRYwwQaUkIF1kA3biqHip 5l142hcp8uimB449LG4+3XxUhJFw1Kb2lRie0Y0jDnp83YBVCyd2uQHjBAMgIyotnpsv XdFWif7cRDtwgCB4lUlE/WlMySiwdjwpAj775oE1h2BjQefZe8CBpDMTpAQxwrogTDX9 SL44UH6nj0Pbih3UMEucRpWYr7iGK2l6axU08DQCXP5Od9DhN09mKcMZEemODPoCWHRp v8ew== X-Gm-Message-State: AKaTC010I+Zf+jqGyPR9+6DTzWvKuIkoQmwlMVg1ryTgCb3zc6Q2xQ4Mt9MLNDqqKJe2K2EgzwU= X-Received: by 10.25.23.80 with SMTP id n77mr1380945lfi.72.1480000990248; Thu, 24 Nov 2016 07:23:10 -0800 (PST) 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 x142sm8215976lfa.32.2016.11.24.07.23.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Nov 2016 07:23:09 -0800 (PST) From: Christophe Milard To: maxim.uvarov@linaro.com, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Thu, 24 Nov 2016 17:22:32 +0100 Message-Id: <1480004553-46760-15-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480004553-46760-1-git-send-email-christophe.milard@linaro.org> References: <1480004553-46760-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCHv9 14/15] 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 b00f8f1..7d9c213 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -439,8 +439,12 @@ static int create_file(int block_index, huge_flag_t huge, uint64_t len, 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; } @@ -762,6 +766,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); @@ -836,11 +841,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 */