From: Matthew Hall <mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
To: "Qiu, Michael" <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "dev-VfR2kkLFssw@public.gmane.org" <dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: [PATCH] add free hugepage function
Date: Tue, 28 Oct 2014 20:44:37 -0700 [thread overview]
Message-ID: <20141029034437.GA29486@mhcomputing.net> (raw)
In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C7CAAB-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
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.
next prev parent reply other threads:[~2014-10-29 3:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 2:54 [PATCH] add free hugepage function linhaifeng
2014-10-29 3:27 ` Qiu, Michael
[not found] ` <533710CFB86FA344BFBF2D6802E60286C7CAAB-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-29 3:44 ` Matthew Hall [this message]
[not found] ` <20141029034437.GA29486-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2014-10-29 5:14 ` Linhaifeng
2014-10-29 5:26 ` Qiu, Michael
[not found] ` <533710CFB86FA344BFBF2D6802E60286C7CB42-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-29 6:49 ` Linhaifeng
[not found] ` <54508DE1.9090908-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-10-29 10:26 ` Bruce Richardson
2014-10-29 14:27 ` Neil Horman
[not found] ` <20141029142745.GA14253-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-10-29 15:22 ` Ramia, Kannan Babu
[not found] ` <682698A055A0F44AA47192B20141149711B6074C-yHIBzpp8AekFyVwBAnZdSLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-29 15:32 ` Neil Horman
[not found] ` <20141029153212.GB14253-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-10-29 16:47 ` Bruce Richardson
2014-10-30 3:23 ` Matthew Hall
[not found] ` <20141030032324.GC3286-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2014-10-30 10:18 ` Neil Horman
[not found] ` <20141030101856.GA24783-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-10-30 14:56 ` Matthew Hall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141029034437.GA29486@mhcomputing.net \
--to=mhall-hv3ognyu3jfzzajbqzqcxq@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.