From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id F2323C336 for ; Thu, 9 Jul 2015 11:19:43 +0200 (CEST) Received: by wiclp1 with SMTP id lp1so103774814wic.0 for ; Thu, 09 Jul 2015 02:19:43 -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:subject:date:message-id:in-reply-to :references; bh=6FSrwjBoJ8UhoVbHb44RYimZguZGSaEAtXJiw9f2Qx0=; b=D+rDpunbRyrmx7sU8jx+/KlgQOX6k3RLE1A3J5Eah9bW7yIUduHe03qrrc6rskBDUF /G/zG+CL+9Y0bx9YTWOiiALTXKSVQUCvs2MSrz4VpeZUDoox4nx0HYaAwmmY3ltCVEI7 veE5Li4OaqtKQaI5wodWd6nsfO6uYSvpJwHjkRNEeLwwtBPFpoOfEMsjwxbiaRKMP5E8 ADvjjXMl5zfoAZtnBp/nQHCNT3NqIRwFklr42Y8XayuJ3EHIahDSACqjJ7Bwj1YmuWxb qXVlXEyzc992kJQqvqSI9acXQu0lHHZZuACA5e/QBQW709XjO6XyEkGXjYa2d0gYbRlE nzNw== X-Gm-Message-State: ALoCoQlUYMcrY4LHvq29DUEVAmMAyAhMJtgGHySsLfA5lFZmtLOvqfGRxw62JsTT27YQXSotsMAe X-Received: by 10.180.74.73 with SMTP id r9mr77185585wiv.84.1436433583697; Thu, 09 Jul 2015 02:19:43 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.151.210]) by smtp.gmail.com with ESMTPSA id um5sm7774777wjc.1.2015.07.09.02.19.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 02:19:42 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Thu, 9 Jul 2015 11:19:21 +0200 Message-Id: <1436433566-328-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1436433566-328-1-git-send-email-david.marchand@6wind.com> References: <1436259634-7077-1-git-send-email-david.marchand@6wind.com> <1436433566-328-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2 1/6] eal/linux: remove useless check on process type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2015 09:19:44 -0000 The code in eal_hugepage_info.c is not reachable by secondary processes. Signed-off-by: David Marchand Acked-by: Sergio Gonzalez Monroy --- lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c index 028e309..6dd8a0b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c @@ -61,31 +61,24 @@ static const char sys_dir_path[] = "/sys/kernel/mm/hugepages"; +/* this function is only called from eal_hugepage_info_init which itself + * is only called from a primary process */ static int32_t get_num_hugepages(const char *subdir) { char path[PATH_MAX]; long unsigned resv_pages, num_pages = 0; - const char *nr_hp_file; + const char *nr_hp_file = "free_hugepages"; const char *nr_rsvd_file = "resv_hugepages"; /* first, check how many reserved pages kernel reports */ snprintf(path, sizeof(path), "%s/%s/%s", sys_dir_path, subdir, nr_rsvd_file); - if (eal_parse_sysfs_value(path, &resv_pages) < 0) return 0; - /* if secondary process, just look at the number of hugepages, - * otherwise look at number of free hugepages */ - if (internal_config.process_type == RTE_PROC_SECONDARY) - nr_hp_file = "nr_hugepages"; - else - nr_hp_file = "free_hugepages"; - snprintf(path, sizeof(path), "%s/%s/%s", sys_dir_path, subdir, nr_hp_file); - if (eal_parse_sysfs_value(path, &num_pages) < 0) return 0; @@ -93,8 +86,8 @@ get_num_hugepages(const char *subdir) RTE_LOG(WARNING, EAL, "No free hugepages reported in %s\n", subdir); - /* adjust num_pages in case of primary process */ - if (num_pages > 0 && internal_config.process_type == RTE_PROC_PRIMARY) + /* adjust num_pages */ + if (num_pages > 0) num_pages -= resv_pages; return (int32_t)num_pages; -- 1.7.10.4