From: David Vrabel <david.vrabel@citrix.com>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen: simplify balloon_first_page() with list_first_entry_or_null()
Date: Wed, 13 Nov 2013 12:09:03 +0000 [thread overview]
Message-ID: <52836BDF.3090700@citrix.com> (raw)
In-Reply-To: <5283662D.1010500@oracle.com>
On 13/11/13 11:44, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
>
> Simplify the code logic of balloon_first_page() by replacing
> the combination of list_empty() and list_first_entry() with
> list_first_entry_or_null(). As a net win, we can change this
> routine to inline as now it's one line.
>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>
> ---
> drivers/xen/balloon.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index b232908..0e4ca20 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -157,11 +157,10 @@ static struct page *balloon_retrieve(bool prefer_highmem)
> return page;
> }
>
> -static struct page *balloon_first_page(void)
> +static inline struct page *balloon_first_page(void)
> {
> - if (list_empty(&ballooned_pages))
> - return NULL;
> - return list_entry(ballooned_pages.next, struct page, lru);
> + return list_first_entry_or_null(&ballooned_pages,
> + struct page, lru);
> }
There's only one user of balloon_first_page(), can you remove
balloon_first_page() and just use list_first_entry_or_null()?
David
next prev parent reply other threads:[~2013-11-13 12:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 11:44 [PATCH] xen: simplify balloon_first_page() with list_first_entry_or_null() Jeff Liu
2013-11-13 12:09 ` David Vrabel [this message]
2013-11-13 12:54 ` Jeff Liu
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=52836BDF.3090700@citrix.com \
--to=david.vrabel@citrix.com \
--cc=jeff.liu@oracle.com \
--cc=xen-devel@lists.xenproject.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.