]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: remove lru parameter from __lru_cache_add and lru_cache_add_lru
authorMel Gorman <mgorman@suse.de>
Fri, 7 Jun 2013 00:07:53 +0000 (10:07 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Jun 2013 05:42:14 +0000 (15:42 +1000)
Similar to __pagevec_lru_add, this patch removes the LRU parameter from
__lru_cache_add and lru_cache_add_lru as the caller does not control the
exact LRU the page gets added to.  lru_cache_add_lru gets renamed to
lru_cache_add the name is silly without the lru parameter.  With the
parameter removed, it is required that the caller indicate if they want
the page added to the active or inactive list by setting or clearing
PageActive respectively.

[akpm@linux-foundation.org: Suggested the patch]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Cc: Jan Kara <jack@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Alexey Lyahkov <alexey.lyashkov@gmail.com>
Cc: Andrew Perepechko <anserper@ya.ru>
Cc: Robin Dong <sanbai@taobao.com>
Cc: Theodore Tso <tytso@mit.edu>
Cc: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Bernd Schubert <bernd.schubert@fastmail.fm>
Cc: David Howells <dhowells@redhat.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/swap.h
mm/rmap.c
mm/swap.c
mm/vmscan.c

index 1701ce4be746502e89b6dfb417547c1ba805d466..85d74373002c0b3f500f6d69ff8631da7ca1564f 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/node.h>
 #include <linux/fs.h>
 #include <linux/atomic.h>
+#include <linux/page-flags.h>
 #include <asm/page.h>
 
 struct notifier_block;
@@ -233,8 +234,8 @@ extern unsigned long 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_lru(struct page *, enum lru_list lru);
+extern void __lru_cache_add(struct page *);
+extern void lru_cache_add(struct page *);
 extern void lru_add_page_tail(struct page *page, struct page *page_tail,
                         struct lruvec *lruvec, struct list_head *head);
 extern void activate_page(struct page *);
@@ -254,12 +255,14 @@ extern void add_page_to_unevictable_list(struct page *page);
  */
 static inline void lru_cache_add_anon(struct page *page)
 {
-       __lru_cache_add(page, LRU_INACTIVE_ANON);
+       ClearPageActive(page);
+       __lru_cache_add(page);
 }
 
 static inline void lru_cache_add_file(struct page *page)
 {
-       __lru_cache_add(page, LRU_INACTIVE_FILE);
+       ClearPageActive(page);
+       __lru_cache_add(page);
 }
 
 /* linux/mm/vmscan.c */
index 6280da86b5d6761ed8a245c3fadb6e42015216c5..e22ceeb6e5ec8a07dafec758a55e26f8a590fe26 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1093,9 +1093,10 @@ void page_add_new_anon_rmap(struct page *page,
        else
                __inc_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES);
        __page_set_anon_rmap(page, vma, address, 1);
-       if (!mlocked_vma_newpage(vma, page))
-               lru_cache_add_lru(page, LRU_ACTIVE_ANON);
-       else
+       if (!mlocked_vma_newpage(vma, page)) {
+               SetPageActive(page);
+               lru_cache_add(page);
+       } else
                add_page_to_unevictable_list(page);
 }
 
index 6a9d0c43924af645b902aa89af4d171862a2a810..ac23602b79aacf570ae5cb14ac35021db7e2f7f3 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -494,15 +494,10 @@ EXPORT_SYMBOL(mark_page_accessed);
  * pagevec is drained. This gives a chance for the caller of __lru_cache_add()
  * have the page added to the active list using mark_page_accessed().
  */
-void __lru_cache_add(struct page *page, enum lru_list lru)
+void __lru_cache_add(struct page *page)
 {
        struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
 
-       if (is_active_lru(lru))
-               SetPageActive(page);
-       else
-               ClearPageActive(page);
-
        page_cache_get(page);
        if (!pagevec_space(pvec))
                __pagevec_lru_add(pvec);
@@ -512,11 +507,10 @@ void __lru_cache_add(struct page *page, enum lru_list lru)
 EXPORT_SYMBOL(__lru_cache_add);
 
 /**
- * lru_cache_add_lru - add a page to a page list
+ * lru_cache_add - add a page to a page list
  * @page: the page to be added to the LRU.
- * @lru: the LRU list to which the page is added.
  */
-void lru_cache_add_lru(struct page *page, enum lru_list lru)
+void lru_cache_add(struct page *page)
 {
        if (PageActive(page)) {
                VM_BUG_ON(PageUnevictable(page));
@@ -525,7 +519,7 @@ void lru_cache_add_lru(struct page *page, enum lru_list lru)
        }
 
        VM_BUG_ON(PageLRU(page));
-       __lru_cache_add(page, lru);
+       __lru_cache_add(page);
 }
 
 /**
index c85794399848df32b43194644422306bc262a71f..b96faea62a110714ce398400977c52a17c992dc5 100644 (file)
@@ -546,7 +546,6 @@ int remove_mapping(struct address_space *mapping, struct page *page)
 void putback_lru_page(struct page *page)
 {
        int lru;
-       int active = !!TestClearPageActive(page);
        int was_unevictable = PageUnevictable(page);
 
        VM_BUG_ON(PageLRU(page));
@@ -561,8 +560,7 @@ redo:
                 * unevictable page on [in]active list.
                 * We know how to handle that.
                 */
-               lru = active + page_lru_base_type(page);
-               lru_cache_add_lru(page, lru);
+               lru_cache_add(page);
        } else {
                /*
                 * Put unevictable pages directly on zone's unevictable