]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch
linux-ti33x-psp 3.2: update to 3.2.25
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.25 / 0005-mm-compaction-make-isolate_lru_page-filter-aware-aga.patch
1 From 67c64d699499fd5b83ca0be6f66eaca18cc29601 Mon Sep 17 00:00:00 2001
2 From: Mel Gorman <mgorman@suse.de>
3 Date: Thu, 12 Jan 2012 17:19:38 -0800
4 Subject: [PATCH 05/73] mm: compaction: make isolate_lru_page() filter-aware
5  again
7 commit c82449352854ff09e43062246af86bdeb628f0c3 upstream.
9 Stable note: Not tracked in Bugzilla. A fix aimed at preserving page aging
10         information by reducing LRU list churning had the side-effect of
11         reducing THP allocation success rates. This was part of a series
12         to restore the success rates while preserving the reclaim fix.
14 Commit 39deaf85 ("mm: compaction: make isolate_lru_page() filter-aware")
15 noted that compaction does not migrate dirty or writeback pages and that
16 is was meaningless to pick the page and re-add it to the LRU list.  This
17 had to be partially reverted because some dirty pages can be migrated by
18 compaction without blocking.
20 This patch updates "mm: compaction: make isolate_lru_page" by skipping
21 over pages that migration has no possibility of migrating to minimise LRU
22 disruption.
24 Signed-off-by: Mel Gorman <mgorman@suse.de>
25 Reviewed-by: Rik van Riel<riel@redhat.com>
26 Cc: Andrea Arcangeli <aarcange@redhat.com>
27 Reviewed-by: Minchan Kim <minchan@kernel.org>
28 Cc: Dave Jones <davej@redhat.com>
29 Cc: Jan Kara <jack@suse.cz>
30 Cc: Andy Isaacson <adi@hexapodia.org>
31 Cc: Nai Xia <nai.xia@gmail.com>
32 Cc: Johannes Weiner <jweiner@redhat.com>
33 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
34 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
35 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
36 ---
37  include/linux/mmzone.h |    2 ++
38  mm/compaction.c        |    3 +++
39  mm/vmscan.c            |   35 +++++++++++++++++++++++++++++++++--
40  3 files changed, 38 insertions(+), 2 deletions(-)
42 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
43 index 905b1e1..25842b6 100644
44 --- a/include/linux/mmzone.h
45 +++ b/include/linux/mmzone.h
46 @@ -173,6 +173,8 @@ static inline int is_unevictable_lru(enum lru_list l)
47  #define ISOLATE_CLEAN          ((__force isolate_mode_t)0x4)
48  /* Isolate unmapped file */
49  #define ISOLATE_UNMAPPED       ((__force isolate_mode_t)0x8)
50 +/* Isolate for asynchronous migration */
51 +#define ISOLATE_ASYNC_MIGRATE  ((__force isolate_mode_t)0x10)
52  
53  /* LRU Isolation modes. */
54  typedef unsigned __bitwise__ isolate_mode_t;
55 diff --git a/mm/compaction.c b/mm/compaction.c
56 index b81625d..979a919 100644
57 --- a/mm/compaction.c
58 +++ b/mm/compaction.c
59 @@ -371,6 +371,9 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
60                         continue;
61                 }
62  
63 +               if (!cc->sync)
64 +                       mode |= ISOLATE_ASYNC_MIGRATE;
65 +
66                 /* Try isolate the page */
67                 if (__isolate_lru_page(page, mode, 0) != 0)
68                         continue;
69 diff --git a/mm/vmscan.c b/mm/vmscan.c
70 index 8342119..1b95e4c 100644
71 --- a/mm/vmscan.c
72 +++ b/mm/vmscan.c
73 @@ -1061,8 +1061,39 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
74  
75         ret = -EBUSY;
76  
77 -       if ((mode & ISOLATE_CLEAN) && (PageDirty(page) || PageWriteback(page)))
78 -               return ret;
79 +       /*
80 +        * To minimise LRU disruption, the caller can indicate that it only
81 +        * wants to isolate pages it will be able to operate on without
82 +        * blocking - clean pages for the most part.
83 +        *
84 +        * ISOLATE_CLEAN means that only clean pages should be isolated. This
85 +        * is used by reclaim when it is cannot write to backing storage
86 +        *
87 +        * ISOLATE_ASYNC_MIGRATE is used to indicate that it only wants to pages
88 +        * that it is possible to migrate without blocking
89 +        */
90 +       if (mode & (ISOLATE_CLEAN|ISOLATE_ASYNC_MIGRATE)) {
91 +               /* All the caller can do on PageWriteback is block */
92 +               if (PageWriteback(page))
93 +                       return ret;
94 +
95 +               if (PageDirty(page)) {
96 +                       struct address_space *mapping;
97 +
98 +                       /* ISOLATE_CLEAN means only clean pages */
99 +                       if (mode & ISOLATE_CLEAN)
100 +                               return ret;
102 +                       /*
103 +                        * Only pages without mappings or that have a
104 +                        * ->migratepage callback are possible to migrate
105 +                        * without blocking
106 +                        */
107 +                       mapping = page_mapping(page);
108 +                       if (mapping && !mapping->a_ops->migratepage)
109 +                               return ret;
110 +               }
111 +       }
112  
113         if ((mode & ISOLATE_UNMAPPED) && page_mapped(page))
114                 return ret;
115 -- 
116 1.7.7.6