lkml.org 
[lkml]   [2016]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] mm: convert make_page_accessed to use compount_page_t()
Date
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
\
 
 \ /
  Last update: 2016-03-27 22:21    [W:0.079 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site