]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mm: remove lru type checks from __isolate_lru_page()
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Wed, 4 Apr 2012 00:08:21 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 4 Apr 2012 03:22:07 +0000 (13:22 +1000)
After patch "mm: forbid lumpy-reclaim in shrink_active_list()" we can
completely remove anon/file and active/inactive lru type filters from
__isolate_lru_page(), because isolation for 0-order reclaim always
isolates pages from right lru list.  And pages-isolation for lumpy
shrink_inactive_list() or memory-compaction anyway allowed to isolate
pages from all evictable lru lists.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmzone.h
include/linux/swap.h
mm/compaction.c
mm/vmscan.c

index aa881de5781a7e7815668e20edaf31e408d6284e..e9e9aa286d6fc2c2be89fdb3b89a6c274e1f3e91 100644 (file)
@@ -183,16 +183,12 @@ struct lruvec {
 #define LRU_ALL_EVICTABLE (LRU_ALL_FILE | LRU_ALL_ANON)
 #define LRU_ALL             ((1 << NR_LRU_LISTS) - 1)
 
-/* Isolate inactive pages */
-#define ISOLATE_INACTIVE       ((__force isolate_mode_t)0x1)
-/* Isolate active pages */
-#define ISOLATE_ACTIVE         ((__force isolate_mode_t)0x2)
 /* Isolate clean file */
-#define ISOLATE_CLEAN          ((__force isolate_mode_t)0x4)
+#define ISOLATE_CLEAN          ((__force isolate_mode_t)0x1)
 /* Isolate unmapped file */
-#define ISOLATE_UNMAPPED       ((__force isolate_mode_t)0x8)
+#define ISOLATE_UNMAPPED       ((__force isolate_mode_t)0x2)
 /* Isolate for asynchronous migration */
-#define ISOLATE_ASYNC_MIGRATE  ((__force isolate_mode_t)0x10)
+#define ISOLATE_ASYNC_MIGRATE  ((__force isolate_mode_t)0x4)
 
 /* LRU Isolation modes. */
 typedef unsigned __bitwise__ isolate_mode_t;
index 14d13d0cc7536b3c741690df0e4f9cb78e13d2e6..6bc6768697d67ba3a48b28fd5bd1b6ff28fcc11c 100644 (file)
@@ -257,7 +257,7 @@ static inline void lru_cache_add_file(struct page *page)
 /* linux/mm/vmscan.c */
 extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
                                        gfp_t gfp_mask, nodemask_t *mask);
-extern int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file);
+extern int __isolate_lru_page(struct page *page, isolate_mode_t mode);
 extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
                                                  gfp_t gfp_mask, bool noswap);
 extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
index 74a8c825ff289a12079701dfc42be4e1787b8d8f..dd2fea5b8c6b4731725eefaeea355dc3ffbc4ea6 100644 (file)
@@ -261,7 +261,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
        unsigned long last_pageblock_nr = 0, pageblock_nr;
        unsigned long nr_scanned = 0, nr_isolated = 0;
        struct list_head *migratelist = &cc->migratepages;
-       isolate_mode_t mode = ISOLATE_ACTIVE|ISOLATE_INACTIVE;
+       isolate_mode_t mode = 0;
 
        /* Do not scan outside zone boundaries */
        low_pfn = max(cc->migrate_pfn, zone->zone_start_pfn);
@@ -375,7 +375,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
                        mode |= ISOLATE_ASYNC_MIGRATE;
 
                /* Try isolate the page */
-               if (__isolate_lru_page(page, mode, 0) != 0)
+               if (__isolate_lru_page(page, mode) != 0)
                        continue;
 
                VM_BUG_ON(PageTransCompound(page));
index 76747475e4d5f37dc2e935d28c7abffc487bb11d..ff5052066f8cbd318304463fc18bef0bcc0eff6f 100644 (file)
@@ -1028,29 +1028,14 @@ keep_lumpy:
  *
  * returns 0 on success, -ve errno on failure.
  */
-int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
+int __isolate_lru_page(struct page *page, isolate_mode_t mode)
 {
-       bool all_lru_mode;
        int ret = -EINVAL;
 
        /* Only take pages on the LRU. */
        if (!PageLRU(page))
                return ret;
 
-       all_lru_mode = (mode & (ISOLATE_ACTIVE|ISOLATE_INACTIVE)) ==
-               (ISOLATE_ACTIVE|ISOLATE_INACTIVE);
-
-       /*
-        * When checking the active state, we need to be sure we are
-        * dealing with comparible boolean values.  Take the logical not
-        * of each.
-        */
-       if (!all_lru_mode && !PageActive(page) != !(mode & ISOLATE_ACTIVE))
-               return ret;
-
-       if (!all_lru_mode && !!page_is_file_cache(page) != file)
-               return ret;
-
        /*
         * When this function is being called for lumpy reclaim, we
         * initially look into all LRU pages, active, inactive and
@@ -1160,7 +1145,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
 
                VM_BUG_ON(!PageLRU(page));
 
-               switch (__isolate_lru_page(page, mode, file)) {
+               switch (__isolate_lru_page(page, mode)) {
                case 0:
                        mem_cgroup_lru_del(page);
                        list_move(&page->lru, dst);
@@ -1218,7 +1203,7 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
                            !PageSwapCache(cursor_page))
                                break;
 
-                       if (__isolate_lru_page(cursor_page, mode, file) == 0) {
+                       if (__isolate_lru_page(cursor_page, mode) == 0) {
                                unsigned int isolated_pages;
 
                                mem_cgroup_lru_del(cursor_page);
@@ -1492,7 +1477,7 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
        unsigned long nr_file;
        unsigned long nr_dirty = 0;
        unsigned long nr_writeback = 0;
-       isolate_mode_t isolate_mode = ISOLATE_INACTIVE;
+       isolate_mode_t isolate_mode = 0;
        int file = is_file_lru(lru);
        struct zone *zone = mz->zone;
        struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz);
@@ -1506,8 +1491,6 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
        }
 
        set_reclaim_mode(priority, sc, false);
-       if (sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM)
-               isolate_mode |= ISOLATE_ACTIVE;
 
        lru_add_drain();
 
@@ -1668,7 +1651,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
        struct page *page;
        struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz);
        unsigned long nr_rotated = 0;
-       isolate_mode_t isolate_mode = ISOLATE_ACTIVE;
+       isolate_mode_t isolate_mode = 0;
        int file = is_file_lru(lru);
        struct zone *zone = mz->zone;