linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, shli@kernel.org
Subject: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
Date: Thu, 19 Oct 2017 20:26:57 +0530	[thread overview]
Message-ID: <20171019145657.11199-1-khandual@linux.vnet.ibm.com> (raw)

Its already assumed that the PageActive flag is clear on the input
page, hence page_lru(page) will pick the base LRU for the page. In
the same way page_lru(page) will pick active base LRU, once the
flag PageActive is set on the page. This change of LRU list should
happen implicitly through the page flags instead of being hard
coded.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 mm/swap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index fcd82bc..494276b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
 {
 	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
 		int file = page_is_file_cache(page);
-		int lru = page_lru_base_type(page);
 
-		del_page_from_lru_list(page, lruvec, lru);
+		del_page_from_lru_list(page, lruvec, page_lru(page));
 		SetPageActive(page);
-		lru += LRU_ACTIVE;
-		add_page_to_lru_list(page, lruvec, lru);
+		add_page_to_lru_list(page, lruvec, page_lru(page));
 		trace_mm_lru_activate(page);
 
 		__count_vm_event(PGACTIVATE);
-- 
1.8.5.2

             reply	other threads:[~2017-10-19 14:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 14:56 Anshuman Khandual [this message]
2017-10-19 15:33 ` [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page() Michal Hocko
2017-10-23  3:22   ` Anshuman Khandual
2017-10-27  4:06     ` Anshuman Khandual
2017-10-27  7:57       ` Michal Hocko
2017-10-31 12:45   ` Vlastimil Babka
2017-11-02 11:44     ` Anshuman Khandual

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=20171019145657.11199-1-khandual@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shli@kernel.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).