From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: Hugh Dickins <hughd@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH 4/4] mm: convert make_page_accessed to use compount_page_t()
Date: Sun, 27 Mar 2016 22:47:40 +0300 [thread overview]
Message-ID: <1459108060-69891-4-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1459108060-69891-1-git-send-email-kirill.shutemov@linux.intel.com>
Just for example, convert one function to just created interface.
This way we cut size of the function by third:
function old new delta
mark_page_accessed 310 203 -107
Not-yet-signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
mm/swap.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/mm/swap.c b/mm/swap.c
index 09fe5e97714a..1fe072ae6ee1 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -360,9 +360,10 @@ static void __lru_cache_activate_page(struct page *page)
*/
void mark_page_accessed(struct page *page)
{
- page = compound_head(page);
- if (!PageActive(page) && !PageUnevictable(page) &&
- PageReferenced(page)) {
+ struct head_page *head = compound_head_t(page);
+ page = &head->page;
+ if (!PageActive(head) && !PageUnevictable(head) &&
+ PageReferenced(head)) {
/*
* If the page is on the LRU, queue it for activation via
@@ -370,15 +371,15 @@ void mark_page_accessed(struct page *page)
* pagevec, mark it active and it'll be moved to the active
* LRU on the next drain.
*/
- if (PageLRU(page))
+ if (PageLRU(head))
activate_page(page);
else
__lru_cache_activate_page(page);
- ClearPageReferenced(page);
+ ClearPageReferenced(head);
if (page_is_file_cache(page))
workingset_activation(page);
- } else if (!PageReferenced(page)) {
- SetPageReferenced(page);
+ } else if (!PageReferenced(head)) {
+ SetPageReferenced(head);
}
if (page_is_idle(page))
clear_page_idle(page);
--
2.8.0.rc3
--
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>
next prev parent reply other threads:[~2016-03-27 19:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-26 18:50 Bloat caused by unnecessary calls to compound_head()? Eric Biggers
2016-03-27 19:46 ` Kirill A. Shutemov
2016-03-27 19:47 ` [PATCH 1/4] page-flags: generate page-flags helpers with script Kirill A. Shutemov
2016-03-27 19:47 ` [PATCH 2/4] mm: introduce struct head_page and compound_head_t Kirill A. Shutemov
2016-03-27 19:47 ` [PATCH 3/4] page-flags: make page flag helpers accept struct head_page Kirill A. Shutemov
2016-03-27 19:47 ` Kirill A. Shutemov [this message]
2016-04-01 1:33 ` Bloat caused by unnecessary calls to compound_head()? Eric Biggers
2016-04-04 10:39 ` Kirill A. Shutemov
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=1459108060-69891-4-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=ebiggers3@gmail.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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).