[PATCH 5/5] mm: remove unlikelys for unlock in rmap.c

Steven Rostedt
2009-03-25T05:22:05Z

[-- Attachment #1: 0005-mm-remove-unlikelys-for-unlock-in-rmap.c.patch --]
[-- Type: text/plain, Size: 2157 bytes --]

From: Steven Rostedt <rostedt@goodmis.org>

Impact: clean up

The annotated branch profiler shows that the rmap calls are likely
called with unlock set.

correct incorrect % Function File Line
------- --------- - -------- ---- ----
0 46100 100 try_to_unmap_anon rmap.c 1013
0 46100 100 try_to_unmap_anon rmap.c 1005
0 5763 100 try_to_unmap_file rmap.c 1074
0 5763 100 try_to_unmap_file rmap.c 1069

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
mm/rmap.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 1652166..ad62fe0 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1002,7 +1002,7 @@ static int try_to_unmap_anon(struct page *page, int unlock, int migration)
unsigned int mlocked = 0;
int ret = SWAP_AGAIN;

- if (MLOCK_PAGES && unlikely(unlock))
+ if (MLOCK_PAGES && unlock)
ret = SWAP_SUCCESS; /* default for try_to_munlock() */

anon_vma = page_lock_anon_vma(page);
@@ -1010,7 +1010,7 @@ static int try_to_unmap_anon(struct page *page, int unlock, int migration)
return ret;

list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
- if (MLOCK_PAGES && unlikely(unlock)) {
+ if (MLOCK_PAGES && unlock) {
if (!((vma->vm_flags & VM_LOCKED) &&
page_mapped_in_vma(page, vma)))
continue; /* must visit all unlocked vmas */
@@ -1066,12 +1066,12 @@ static int try_to_unmap_file(struct page *page, int unlock, int migration)
unsigned int mapcount;
unsigned int mlocked = 0;

- if (MLOCK_PAGES && unlikely(unlock))
+ if (MLOCK_PAGES && unlock)
ret = SWAP_SUCCESS; /* default for try_to_munlock() */

spin_lock(&mapping->i_mmap_lock);
vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
- if (MLOCK_PAGES && unlikely(unlock)) {
+ if (MLOCK_PAGES && unlock) {
if (!((vma->vm_flags & VM_LOCKED) &&
page_mapped_in_vma(page, vma)))
continue; /* must visit all vmas */
--
1.6.2

--