|
@@ -620,13 +620,22 @@ void page_address_init(void);
|
|
|
/*
|
|
|
* On an anonymous page mapped into a user virtual memory area,
|
|
|
* page->mapping points to its anon_vma, not to a struct address_space;
|
|
|
- * with the PAGE_MAPPING_ANON bit set to distinguish it.
|
|
|
+ * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
|
|
|
+ *
|
|
|
+ * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
|
|
|
+ * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
|
|
|
+ * and then page->mapping points, not to an anon_vma, but to a private
|
|
|
+ * structure which KSM associates with that merged page. See ksm.h.
|
|
|
+ *
|
|
|
+ * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
|
|
|
*
|
|
|
* Please note that, confusingly, "page_mapping" refers to the inode
|
|
|
* address_space which maps the page from disk; whereas "page_mapped"
|
|
|
* refers to user virtual address space into which the page is mapped.
|
|
|
*/
|
|
|
#define PAGE_MAPPING_ANON 1
|
|
|
+#define PAGE_MAPPING_KSM 2
|
|
|
+#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
|
|
|
|
|
|
extern struct address_space swapper_space;
|
|
|
static inline struct address_space *page_mapping(struct page *page)
|
|
@@ -644,6 +653,12 @@ static inline struct address_space *page_mapping(struct page *page)
|
|
|
return mapping;
|
|
|
}
|
|
|
|
|
|
+/* Neutral page->mapping pointer to address_space or anon_vma or other */
|
|
|
+static inline void *page_rmapping(struct page *page)
|
|
|
+{
|
|
|
+ return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
|
|
|
+}
|
|
|
+
|
|
|
static inline int PageAnon(struct page *page)
|
|
|
{
|
|
|
return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
|