summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@zip.com.au>2002-07-18 21:09:02 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-07-18 21:09:02 -0700
commit6a2ea3382b534e937ba2153f4a0c6021e04a1ef5 (patch)
treeee967db238da26f5335651871b04ff1b3a75594e /include/linux
parentfa08cc8377bf0942822c468cf26581012e69c9c9 (diff)
[PATCH] avoid allocating pte_chains for unshared pages
Patch from David McCracken. It is an optimisation to the rmap pte_chains. In the common case where a page is mapped by only a single pte, we don't need to allocate a pte_chain structure. Just make the page's pte_chain pointer point straight at that pte and flag this with PG_direct.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mm.h5
-rw-r--r--include/linux/page-flags.h12
2 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0c0b6d41dbb0..c470238148b6 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -157,8 +157,11 @@ struct page {
updated asynchronously */
struct list_head lru; /* Pageout list, eg. active_list;
protected by pagemap_lru_lock !! */
- struct pte_chain * pte_chain; /* Reverse pte mapping pointer.
+ union {
+ struct pte_chain * chain; /* Reverse pte mapping pointer.
* protected by PG_chainlock */
+ pte_t * direct;
+ } pte;
unsigned long private; /* mapping-private opaque data */
/*
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 7cdd56c8cc3e..a1efdff4d23c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -64,8 +64,10 @@
#define PG_private 12 /* Has something at ->private */
#define PG_writeback 13 /* Page is under writeback */
-#define PG_nosave 15 /* Used for system suspend/resume */
-#define PG_chainlock 16 /* lock bit for ->pte_chain */
+#define PG_nosave 14 /* Used for system suspend/resume */
+#define PG_chainlock 15 /* lock bit for ->pte_chain */
+
+#define PG_direct 16 /* ->pte_chain points directly at pte */
/*
* Global page accounting. One instance per CPU.
@@ -217,6 +219,12 @@ extern void get_page_state(struct page_state *ret);
#define ClearPageNosave(page) clear_bit(PG_nosave, &(page)->flags)
#define TestClearPageNosave(page) test_and_clear_bit(PG_nosave, &(page)->flags)
+#define PageDirect(page) test_bit(PG_direct, &(page)->flags)
+#define SetPageDirect(page) set_bit(PG_direct, &(page)->flags)
+#define TestSetPageDirect(page) test_and_set_bit(PG_direct, &(page)->flags)
+#define ClearPageDirect(page) clear_bit(PG_direct, &(page)->flags)
+#define TestClearPageDirect(page) test_and_clear_bit(PG_direct, &(page)->flags)
+
/*
* inlines for acquisition and release of PG_chainlock
*/