linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"nickpiggin@yahoo.com.au" <nickpiggin@yahoo.com.au>,
	Christoph Lameter <clameter@sgi.com>,
	"Lee.Schermerhorn@hp.com" <Lee.Schermerhorn@hp.com>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC][PATCH] overwride page->mapping [1/3] cleanup
Date: Wed, 12 Sep 2007 11:45:33 +0900	[thread overview]
Message-ID: <20070912114533.3ffc5235.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20070912114322.e4d8a86e.kamezawa.hiroyu@jp.fujitsu.com>

Clean up: Gather all page->mapping handling functions to page-cache.h

no functional changes. (will be merged to "add page->mapping interface function"
patch.)

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 include/linux/mm.h         |   47 --------------------------------------------
 include/linux/page-cache.h |   48 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 47 deletions(-)

Index: test-2.6.23-rc4-mm1/include/linux/mm.h
===================================================================
--- test-2.6.23-rc4-mm1.orig/include/linux/mm.h
+++ test-2.6.23-rc4-mm1/include/linux/mm.h
@@ -550,53 +550,6 @@ void page_address_init(void);
 #endif
 
 /*
- * 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.
- *
- * 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
-
-extern struct address_space swapper_space;
-static inline struct address_space *page_mapping(struct page *page)
-{
-	struct address_space *mapping = (struct address_space *)page->mapping;
-
-	VM_BUG_ON(PageSlab(page));
-	if (unlikely(PageSwapCache(page)))
-		mapping = &swapper_space;
-#ifdef CONFIG_SLUB
-	else if (unlikely(PageSlab(page)))
-		mapping = NULL;
-#endif
-	else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
-		mapping = NULL;
-	return mapping;
-}
-
-static inline int PageAnon(struct page *page)
-{
-	return (page->mapping & PAGE_MAPPING_ANON) != 0;
-}
-
-static inline struct anon_vma *page_mapping_anon(struct page *page)
-{
-	if (PageAnon(page))
-		return (struct anon_vma *)(page->mapping - PAGE_MAPPING_ANON);
-	return NULL;
-}
-
-static inline struct address_space *page_mapping_cache(struct page *page)
-{
-	if (PageAnon(page))
-		return NULL;
-	return (struct address_space *) page->mapping;
-}
-
-/*
  * Return the pagecache index of the passed page.  Regular pagecache pages
  * use ->index whereas swapcache pages use ->private
  */
Index: test-2.6.23-rc4-mm1/include/linux/page-cache.h
===================================================================
--- test-2.6.23-rc4-mm1.orig/include/linux/page-cache.h
+++ test-2.6.23-rc4-mm1/include/linux/page-cache.h
@@ -7,8 +7,56 @@
 #define _LINUX_PAGECACHE_H
 
 #include <linux/mm.h>
+#include <linux/rmap.h>
 /* page_mapping_xxx() function is defined in mm.h */
 
+/*
+ * 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.
+ *
+ * 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
+
+static inline int PageAnon(struct page *page)
+{
+	return (page->mapping & PAGE_MAPPING_ANON) != 0;
+}
+
+extern struct address_space swapper_space;
+static inline struct address_space *page_mapping(struct page *page)
+{
+	struct address_space *mapping = (struct address_space *)page->mapping;
+
+	VM_BUG_ON(PageSlab(page));
+	if (unlikely(PageSwapCache(page)))
+		mapping = &swapper_space;
+#ifdef CONFIG_SLUB
+	else if (unlikely(PageSlab(page)))
+		mapping = NULL;
+#endif
+	else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
+		mapping = NULL;
+	return mapping;
+}
+
+static inline struct anon_vma *page_mapping_anon(struct page *page)
+{
+	if (!page->mapping || !PageAnon(page))
+		return NULL;
+	return (struct anon_vma *)(page->mapping - PAGE_MAPPING_ANON);
+}
+
+static inline struct address_space *page_mapping_cache(struct page *page)
+{
+	if (!page->mapping || PageAnon(page))
+		return NULL;
+	return (struct address_space *)page->mapping;
+}
+
 static inline int page_is_pagecache(struct page *page)
 {
 	if (!page->mapping || (page->mapping & PAGE_MAPPING_ANON))

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-09-12  2:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12  2:43 [RFC][PATCH] overwride page->mapping [0/3] intro KAMEZAWA Hiroyuki
2007-09-12  2:45 ` KAMEZAWA Hiroyuki [this message]
2007-09-12  2:47 ` [RFC][PATCH] overwride page->mapping [2/3] page_mapping_info KAMEZAWA Hiroyuki
2007-09-12  2:48 ` [RFC][PATCH] override page->mapping [3/3] mlock counter per page KAMEZAWA Hiroyuki
2007-09-12  8:42 ` [RFC][PATCH] overwride page->mapping [0/3] intro Balbir Singh
2007-09-12 13:28   ` KAMEZAWA Hiroyuki
2007-09-12 19:10   ` Christoph Lameter
2007-09-12 19:12     ` Martin Bligh
2007-09-12 19:17       ` Christoph Lameter
2007-09-13  0:32       ` KAMEZAWA Hiroyuki
2007-09-13  1:05         ` Christoph Lameter
2007-09-13  1:27           ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070912114533.3ffc5235.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox