From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 50DB6595E for ; Tue, 7 Jul 2015 11:00:48 +0200 (CEST) Received: by wgjx7 with SMTP id x7so161561494wgj.2 for ; Tue, 07 Jul 2015 02:00:48 -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=vChhA2QXReTT0a5CSJG/xhprWGfCQKWjQMGRwCtF9uI=; b=jHBCbxO3gMr0Uedei0C6/xS75HaHOWW1cpW2SRdI/Na1uHhoFoQxq33HL8oRCVKEUS B362o1EWeUDSkD0RnszSn0DX58tXZ2/wERrgZ7hSCQgKgXCwEr5EtIHGsbGIw4CpInsQ jSztGQv63tSkPAqaLSiD6jjlzK0BiA9V5SCjK+IjGtF6klVnXJbRiO1bz8+cbmHeu8Mn BJ+Pm3f5rOe80A3zYKxvPFM1Y5m3YnvfSvDAfYLabNY0dtDoGw8f/7c+kadH99PeO3Ud z5L9j88aYSUBJrzBnwpe/wkapOu5PNWttk1kCa3KCLYpPCidszmoHBL3CAAMOvn26Gvd pp8A== X-Gm-Message-State: ALoCoQmUy2ffKCkKG463KoceFWeVcobTPlZeGGrMDcXg4LY8aP5cJiC0BTY5fuWSVdk4H1/FbGfP X-Received: by 10.195.11.202 with SMTP id ek10mr6594174wjd.12.1436259647957; Tue, 07 Jul 2015 02:00:47 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.151.210]) by mx.google.com with ESMTPSA id y19sm32737674wia.15.2015.07.07.02.00.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 02:00:47 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Tue, 7 Jul 2015 11:00:29 +0200 Message-Id: <1436259634-7077-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1436259634-7077-1-git-send-email-david.marchand@6wind.com> References: <1436259634-7077-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 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: Tue, 07 Jul 2015 09:00:48 -0000 The code in eal_hugepage_info.c is not reachable by secondary processes. Signed-off-by: David Marchand --- 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