From: Jeff Liu <jeff.liu@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: boris.ostrovsky@oracle.com, David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH v2] xen: simplify balloon_first_page() with list_first_entry_or_null()
Date: Wed, 13 Nov 2013 20:59:58 +0800 [thread overview]
Message-ID: <528377CE.9090505@oracle.com> (raw)
From: Jie Liu <jeff.liu@oracle.com>
Replace the code logic at balloon_first_page() by calling
list_first_entry_or_null() directly. since here is only
one user of that routine, therefore we can just remove it.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
v2: remove balloon_first_page() with this change.
drivers/xen/balloon.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 55ea73f..16ffe91 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -157,13 +157,6 @@ static struct page *balloon_retrieve(bool prefer_highmem)
return page;
}
-static struct page *balloon_first_page(void)
-{
- if (list_empty(&ballooned_pages))
- return NULL;
- return list_entry(ballooned_pages.next, struct page, lru);
-}
-
static struct page *balloon_next_page(struct page *page)
{
struct list_head *next = page->lru.next;
@@ -328,7 +321,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
if (nr_pages > ARRAY_SIZE(frame_list))
nr_pages = ARRAY_SIZE(frame_list);
- page = balloon_first_page();
+ page = list_first_entry_or_null(&ballooned_pages, struct page, lru);
for (i = 0; i < nr_pages; i++) {
if (!page) {
nr_pages = i;
--
1.8.3.2
next reply other threads:[~2013-11-13 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 12:59 Jeff Liu [this message]
2013-11-13 14:03 ` [PATCH v2] xen: simplify balloon_first_page() with list_first_entry_or_null() David Vrabel
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=528377CE.9090505@oracle.com \
--to=jeff.liu@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).