summaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorRoss Zwisler <ross.zwisler@linux.intel.com>2016-01-22 18:10:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 20:02:18 -0500
commitf9fe48bece3af2d60e1bad65db4825f5a025dd36 (patch)
tree78f56ae2a1636fa9f8ec26466d4a94a16eadd5dc /mm/vmscan.c
parent3f4a2670deea53e3765e24a7f46aafe6f077cb68 (diff)
dax: support dirty DAX entries in radix tree
Add support for tracking dirty DAX entries in the struct address_space radix tree. This tree is already used for dirty page writeback, and it already supports the use of exceptional (non struct page*) entries. In order to properly track dirty DAX pages we will insert new exceptional entries into the radix tree that represent dirty DAX PTE or PMD pages. These exceptional entries will also contain the writeback addresses for the PTE or PMD faults that we can use at fsync/msync time. There are currently two types of exceptional entries (shmem and shadow) that can be placed into the radix tree, and this adds a third. We rely on the fact that only one type of exceptional entry can be found in a given radix tree based on its usage. This happens for free with DAX vs shmem but we explicitly prevent shadow entries from being added to radix trees for DAX mappings. The only shadow entries that would be generated for DAX radix trees would be to track zero page mappings that were created for holes. These pages would receive minimal benefit from having shadow entries, and the choice to have only one type of exceptional entry in a given radix tree makes the logic simpler both in clear_exceptional_entry() and in the rest of DAX. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Dave Chinner <david@fromorbit.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jan Kara <jack@suse.com> Cc: Jeff Layton <jlayton@poochiereds.net> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Hugh Dickins <hughd@google.com> 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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index bd620b65db52..eb3dd37ccd7c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -46,6 +46,7 @@
46#include <linux/oom.h> 46#include <linux/oom.h>
47#include <linux/prefetch.h> 47#include <linux/prefetch.h>
48#include <linux/printk.h> 48#include <linux/printk.h>
49#include <linux/dax.h>
49 50
50#include <asm/tlbflush.h> 51#include <asm/tlbflush.h>
51#include <asm/div64.h> 52#include <asm/div64.h>
@@ -671,9 +672,15 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
671 * inode reclaim needs to empty out the radix tree or 672 * inode reclaim needs to empty out the radix tree or
672 * the nodes are lost. Don't plant shadows behind its 673 * the nodes are lost. Don't plant shadows behind its
673 * back. 674 * back.
675 *
676 * We also don't store shadows for DAX mappings because the
677 * only page cache pages found in these are zero pages
678 * covering holes, and because we don't want to mix DAX
679 * exceptional entries and shadow exceptional entries in the
680 * same page_tree.
674 */ 681 */
675 if (reclaimed && page_is_file_cache(page) && 682 if (reclaimed && page_is_file_cache(page) &&
676 !mapping_exiting(mapping)) 683 !mapping_exiting(mapping) && !dax_mapping(mapping))
677 shadow = workingset_eviction(mapping, page); 684 shadow = workingset_eviction(mapping, page);
678 __delete_from_page_cache(page, shadow, memcg); 685 __delete_from_page_cache(page, shadow, memcg);
679 spin_unlock_irqrestore(&mapping->tree_lock, flags); 686 spin_unlock_irqrestore(&mapping->tree_lock, flags);