From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
ngupta@vflare.org, konrad.wilk@oracle.com,
sjenning@linux.vnet.ibm.com, minchan@kernel.org,
hughd@google.com, akpm@linux-foundation.org, riel@redhat.com,
hannes@cmpxchg.org, dan.magenheimer@oracle.com,
aarcange@redhat.com, mgorman@suse.de, gregkh@linuxfoundation.org
Subject: [RFC/PATCH 1/3] swap: allow adding of pages to tail of anonymous inactive queue
Date: Wed, 3 Oct 2012 15:43:52 -0700 [thread overview]
Message-ID: <1349304234-19273-2-git-send-email-dan.magenheimer@oracle.com> (raw)
In-Reply-To: <1349304234-19273-1-git-send-email-dan.magenheimer@oracle.com>
When moving a page of anonymous data out of zcache and back
into swap cache, such pages are VERY inactive, and we want
them to be swapped to disk ASAP. So we need to add them
at the tail of the proper queue.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
---
include/linux/swap.h | 10 ++++++++++
mm/swap.c | 16 ++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 388e706..d3c7281 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -225,6 +225,7 @@ extern unsigned int nr_free_pagecache_pages(void);
/* linux/mm/swap.c */
extern void __lru_cache_add(struct page *, enum lru_list lru);
+extern void __lru_cache_add_tail(struct page *, enum lru_list lru);
extern void lru_cache_add_lru(struct page *, enum lru_list lru);
extern void lru_add_page_tail(struct page *page, struct page *page_tail,
struct lruvec *lruvec);
@@ -247,6 +248,15 @@ static inline void lru_cache_add_anon(struct page *page)
{
__lru_cache_add(page, LRU_INACTIVE_ANON);
}
+
+/**
+ * lru_cache_add_tail: add a page to the tail of the page lists
+ * @page: the page to add
+ */
+static inline void lru_cache_add_anon_tail(struct page *page)
+{
+ __lru_cache_add_tail(page, LRU_INACTIVE_ANON);
+}
static inline void lru_cache_add_file(struct page *page)
{
diff --git a/mm/swap.c b/mm/swap.c
index 7782588..67216d8 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -456,6 +456,22 @@ void __lru_cache_add(struct page *page, enum lru_list lru)
put_cpu_var(lru_add_pvecs);
}
EXPORT_SYMBOL(__lru_cache_add);
+
+void __lru_cache_add_tail(struct page *page, enum lru_list lru)
+{
+ struct pagevec *pvec = &get_cpu_var(lru_add_pvecs)[lru];
+ unsigned long flags;
+
+ page_cache_get(page);
+ if (!pagevec_add(pvec, page)) {
+ __pagevec_lru_add(pvec, lru);
+ local_irq_save(flags);
+ pagevec_move_tail(pvec);
+ local_irq_restore(flags);
+ }
+ put_cpu_var(lru_add_pvecs);
+}
+EXPORT_SYMBOL(__lru_cache_add_tail);
/**
* lru_cache_add_lru - add a page to a page list
--
1.7.1
--
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:[~2012-10-03 22:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 22:43 [RFC/PATCH 0/3] swap/frontswap: allow movement of zcache pages to swap Dan Magenheimer
2012-10-03 22:43 ` Dan Magenheimer [this message]
2012-10-03 22:43 ` [RFC/PATCH 2/3] swap: add read_frontswap_async to move a page from frontswap to swapcache Dan Magenheimer
2012-10-03 22:43 ` [RFC/PATCH 3/3] frontswap/swap: allow frontswap "unuse" and add metadata for tracking it Dan Magenheimer
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=1349304234-19273-2-git-send-email-dan.magenheimer@oracle.com \
--to=dan.magenheimer@oracle.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=riel@redhat.com \
--cc=sjenning@linux.vnet.ibm.com \
/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).