From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6762A7F50 for ; Wed, 29 Oct 2014 06:19:26 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 28 Oct 2014 22:22:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,808,1406617200"; d="scan'208";a="613213236" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by fmsmga001.fm.intel.com with ESMTP; 28 Oct 2014 22:28:14 -0700 Received: from kmsmsx151.gar.corp.intel.com (172.21.73.86) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 29 Oct 2014 13:26:35 +0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 29 Oct 2014 13:26:34 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.202]) by shsmsx102.ccr.corp.intel.com ([169.254.2.156]) with mapi id 14.03.0195.001; Wed, 29 Oct 2014 13:26:33 +0800 From: "Qiu, Michael" To: Matthew Hall Thread-Topic: [dpdk-dev] [PATCH] add free hugepage function Thread-Index: AQHP8yPWQcc+h2Wonkit2TyrlWBr4w== Date: Wed, 29 Oct 2014 05:26:33 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286C7CB42@SHSMSX101.ccr.corp.intel.com> References: <1414551269-5820-1-git-send-email-haifeng.lin@huawei.com> <533710CFB86FA344BFBF2D6802E60286C7CAAB@SHSMSX101.ccr.corp.intel.com> <20141029034437.GA29486@mhcomputing.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 05:19:26 -0000 =1B$B:_=1B(B 10/29/2014 11:46 AM, Matthew Hall =1B$B On Wed, Oct 29, 2014 at 03:27:58AM +0000, Qiu, Michael wrote:=0A= >> I just saw one return path with value '0', and no any other place =0A= >> return a negative value, so it is better to be designed as one=0A= >> non-return function,=0A= >>=0A= >> +void=0A= >> +rte_eal_hugepage_free(void)=0A= >> +{=0A= >> + struct hugepage_file *hugepg_tbl =3D g_hugepage_table.hugepg_tbl;=0A= >> + unsigned i;=0A= >> + unsigned nr_hugefiles =3D g_hugepage_table.nr_hugefiles;=0A= >> +=0A= >> + RTE_LOG(INFO, EAL, "unlink %u hugepage files\n", nr_hugefiles);=0A= >> +=0A= >> + for (i =3D 0; i < nr_hugefiles; i++) {=0A= >> + unlink(hugepg_tbl[i].filepath);=0A= >> + hugepg_tbl[i].orig_va =3D NULL;=0A= >> + }=0A= >> +}=0A= >> +=0A= >>=0A= >> Thanks,=0A= >> Michael=0A= > Actually, I don't think that's quite right.=0A= >=0A= > http://linux.die.net/man/2/unlink=0A= >=0A= > "On success, zero is returned. On error, -1 is returned, and errno is set= =0A= > appropriately." So it should be returning an error, and logging a message= for =0A= > a file it cannot unlink or people will be surprised with weird failures.= =0A= =0A= Really need one message for unlink failed, but I'm afraid that if it=0A= make sense for return an error code when application exit.=0A= =0A= Thanks=0A= Michael=0A= > It also had some minor typos / English in the comments but we can fix tha= t too.=0A= >=0A= > Matthew.=0A= >=0A= =0A=