From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.mhcomputing.net (master.mhcomputing.net [74.208.46.186]) by dpdk.org (Postfix) with ESMTP id E1E967F3C for ; Wed, 29 Oct 2014 04:36:51 +0100 (CET) Received: by mail.mhcomputing.net (Postfix, from userid 1000) id 389CB80C50B; Tue, 28 Oct 2014 20:44:37 -0700 (PDT) Date: Tue, 28 Oct 2014 20:44:37 -0700 From: Matthew Hall To: "Qiu, Michael" Message-ID: <20141029034437.GA29486@mhcomputing.net> References: <1414551269-5820-1-git-send-email-haifeng.lin@huawei.com> <533710CFB86FA344BFBF2D6802E60286C7CAAB@SHSMSX101.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C7CAAB@SHSMSX101.ccr.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] add free hugepage function 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: Wed, 29 Oct 2014 03:36:52 -0000 On Wed, Oct 29, 2014 at 03:27:58AM +0000, Qiu, Michael wrote: > I just saw one return path with value '0', and no any other place > return a negative value, so it is better to be designed as one > non-return function, > > +void > +rte_eal_hugepage_free(void) > +{ > + struct hugepage_file *hugepg_tbl = g_hugepage_table.hugepg_tbl; > + unsigned i; > + unsigned nr_hugefiles = g_hugepage_table.nr_hugefiles; > + > + RTE_LOG(INFO, EAL, "unlink %u hugepage files\n", nr_hugefiles); > + > + for (i = 0; i < nr_hugefiles; i++) { > + unlink(hugepg_tbl[i].filepath); > + hugepg_tbl[i].orig_va = NULL; > + } > +} > + > > Thanks, > Michael Actually, I don't think that's quite right. http://linux.die.net/man/2/unlink "On success, zero is returned. On error, -1 is returned, and errno is set appropriately." So it should be returning an error, and logging a message for a file it cannot unlink or people will be surprised with weird failures. It also had some minor typos / English in the comments but we can fix that too. Matthew.