From: Andrea Arcangeli <aarcange@redhat.com>
To: Hugh Dickins <hughd@google.com>, Davidlohr Bueso <dave@stgolabs.net>
Cc: linux-mm@kvack.org, Petr Holasek <pholasek@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 5/5] ksm: unstable_tree_search_insert error checking cleanup
Date: Mon, 2 Nov 2015 18:01:31 +0100 [thread overview]
Message-ID: <1446483691-8494-6-git-send-email-aarcange@redhat.com> (raw)
In-Reply-To: <1446483691-8494-1-git-send-email-aarcange@redhat.com>
get_mergeable_page() can only return NULL (also in case of errors) or
the pinned mergeable page. It can't return an error different than
NULL. This optimizes away the unnecessary error check.
Add a return after the "out:" label in the callee to make it more
readable.
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
mm/ksm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 0183083..b5cd647 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -475,7 +475,8 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)
flush_dcache_page(page);
} else {
put_page(page);
-out: page = NULL;
+out:
+ page = NULL;
}
up_read(&mm->mmap_sem);
return page;
@@ -1358,7 +1359,7 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
cond_resched();
tree_rmap_item = rb_entry(*new, struct rmap_item, node);
tree_page = get_mergeable_page(tree_rmap_item);
- if (IS_ERR_OR_NULL(tree_page))
+ if (!tree_page)
return NULL;
/*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2015-11-02 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 17:01 [PATCH 0/5] KSM updates v2 Andrea Arcangeli
2015-11-02 17:01 ` [PATCH 1/5] mm: add cond_resched() to the rmap walks Andrea Arcangeli
2015-11-02 20:31 ` Davidlohr Bueso
2015-11-02 17:01 ` [PATCH 2/5] ksm: don't fail stable tree lookups if walking over stale stable_nodes Andrea Arcangeli
2015-11-02 17:01 ` [PATCH 3/5] ksm: use the helper method to do the hlist_empty check Andrea Arcangeli
2015-11-02 17:01 ` [PATCH 4/5] ksm: use find_mergeable_vma in try_to_merge_with_ksm_page Andrea Arcangeli
2015-11-02 17:01 ` Andrea Arcangeli [this message]
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=1446483691-8494-6-git-send-email-aarcange@redhat.com \
--to=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=pholasek@redhat.com \
/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).