diff options
author | Mel Gorman <mgorman@suse.de> | 2015-09-04 15:47:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-04 16:54:41 -0700 |
commit | d950c9477d51f0cefc2ed3cf76e695d46af0d9c1 (patch) | |
tree | d6ba89db328ec09b2140a84dcdf1bd8ca5cbeaa4 /mm/vmscan.c | |
parent | 72b252aed506b8f1a03f7abd29caef4cdf6a043b (diff) | |
download | linux-rpi-d950c9477d51f0cefc2ed3cf76e695d46af0d9c1.tar.gz linux-rpi-d950c9477d51f0cefc2ed3cf76e695d46af0d9c1.tar.bz2 linux-rpi-d950c9477d51f0cefc2ed3cf76e695d46af0d9c1.zip |
mm: defer flush of writable TLB entries
If a PTE is unmapped and it's dirty then it was writable recently. Due to
deferred TLB flushing, it's best to assume a writable TLB cache entry
exists. With that assumption, the TLB must be flushed before any IO can
start or the page is freed to avoid lost writes or data corruption. This
patch defers flushing of potentially writable TLBs as long as possible.
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 99ec00d6a5dd..b1139039122a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1098,7 +1098,12 @@ static unsigned long shrink_page_list(struct list_head *page_list, if (!sc->may_writepage) goto keep_locked; - /* Page is dirty, try to write it out here */ + /* + * Page is dirty. Flush the TLB if a writable entry + * potentially exists to avoid CPU writes after IO + * starts and then write it out here. + */ + try_to_unmap_flush_dirty(); switch (pageout(page, mapping, sc)) { case PAGE_KEEP: goto keep_locked; |