From: Jacobo Giralt <jacobo.giralt@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, mgorman@suse.de,
minchan.kim@gmail.com, hughd@google.com, hannes@cmpxchg.org,
npiggin@suse.de
Subject: [PATCH] mm: migrate: One less atomic operation
Date: Sat, 05 Nov 2011 15:38:17 +0100 [thread overview]
Message-ID: <1320503897.2428.8.camel@discretia> (raw)
>From 3754c8617ef4377ce2ca2e3b28bdc28f8de1aa0d Mon Sep 17 00:00:00 2001
From: Jacobo Giralt <jacobo.giralt@gmail.com>
Date: Sat, 5 Nov 2011 13:12:50 +0100
Subject: [PATCH] mm: migrate: One less atomic operation
migrate_page_move_mapping drops a reference from the
old page after unfreezing its counter. Both operations
can be merged into a single atomic operation by
directly unfreezing to one less reference.
The same applies to migrate_huge_page_move_mapping.
Signed-off-by: Jacobo Giralt <jacobo.giralt@gmail.com>
---
mm/migrate.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 33358f8..46d04a0 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -269,12 +269,12 @@ static int migrate_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage);
- page_unfreeze_refs(page, expected_count);
/*
- * Drop cache reference from old page.
+ * Drop cache reference from old page by unfreezing
+ * to one less reference.
* We know this isn't the last reference.
*/
- __put_page(page);
+ page_unfreeze_refs(page, expected_count - 1);
/*
* If moved to a different zone then also account
@@ -334,9 +334,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage);
- page_unfreeze_refs(page, expected_count);
-
- __put_page(page);
+ page_unfreeze_refs(page, expected_count - 1);
spin_unlock_irq(&mapping->tree_lock);
return 0;
--
1.7.5.4
WARNING: multiple messages have this Message-ID (diff)
From: Jacobo Giralt <jacobo.giralt@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, mgorman@suse.de,
minchan.kim@gmail.com, hughd@google.com, hannes@cmpxchg.org,
npiggin@suse.de
Subject: [PATCH] mm: migrate: One less atomic operation
Date: Sat, 05 Nov 2011 15:38:17 +0100 [thread overview]
Message-ID: <1320503897.2428.8.camel@discretia> (raw)
next reply other threads:[~2011-11-05 14:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-05 14:38 Jacobo Giralt [this message]
2011-11-05 14:38 ` [PATCH] mm: migrate: One less atomic operation Jacobo Giralt
2011-11-05 14:48 ` Jacobo Giralt
2011-11-05 14:48 ` Jacobo Giralt
2011-11-08 22:57 ` Andrew Morton
2011-11-08 22:57 ` Andrew Morton
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=1320503897.2428.8.camel@discretia \
--to=jacobo.giralt@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan.kim@gmail.com \
--cc=npiggin@suse.de \
/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.