diff options
| author | Andrew Morton <akpm@zip.com.au> | 2002-09-03 05:33:46 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-03 05:33:46 -0700 |
| commit | 11bf19bc0eb48735772e664d07573f916f6e3f29 (patch) | |
| tree | 441037455364b8a1241238f7d9a12035da4ffdc1 | |
| parent | ef5bf0b55cb5563d80acdc7a8cbb54b8b86d07c3 (diff) | |
[PATCH] place rmap locking in rmap-locking.h
The rmap locking inlines are causing some header file
dependency/ordering problems - move them out of page-flags.h and into
their own header file.
| -rw-r--r-- | include/linux/page-flags.h | 30 | ||||
| -rw-r--r-- | include/linux/rmap-locking.h | 33 | ||||
| -rw-r--r-- | mm/rmap.c | 1 | ||||
| -rw-r--r-- | mm/vmscan.c | 1 |
4 files changed, 35 insertions, 30 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 5a49020e728b..2b2eb67ae7a8 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -229,36 +229,6 @@ extern void get_page_state(struct page_state *ret); #define TestClearPageDirect(page) test_and_clear_bit(PG_direct, &(page)->flags) /* - * inlines for acquisition and release of PG_chainlock - */ -static inline void pte_chain_lock(struct page *page) -{ - /* - * Assuming the lock is uncontended, this never enters - * the body of the outer loop. If it is contended, then - * within the inner loop a non-atomic test is used to - * busywait with less bus contention for a good time to - * attempt to acquire the lock bit. - */ - preempt_disable(); -#ifdef CONFIG_SMP - while (test_and_set_bit(PG_chainlock, &page->flags)) { - while (test_bit(PG_chainlock, &page->flags)) - cpu_relax(); - } -#endif -} - -static inline void pte_chain_unlock(struct page *page) -{ -#ifdef CONFIG_SMP - smp_mb__before_clear_bit(); - clear_bit(PG_chainlock, &page->flags); -#endif - preempt_enable(); -} - -/* * The PageSwapCache predicate doesn't use a PG_flag at this time, * but it may again do so one day. */ diff --git a/include/linux/rmap-locking.h b/include/linux/rmap-locking.h new file mode 100644 index 000000000000..302a58f54ca3 --- /dev/null +++ b/include/linux/rmap-locking.h @@ -0,0 +1,33 @@ +/* + * include/linux/rmap-locking.h + * + * Locking primitives for exclusive access to a page's reverse-mapping + * pte chain. + */ + +static inline void pte_chain_lock(struct page *page) +{ + /* + * Assuming the lock is uncontended, this never enters + * the body of the outer loop. If it is contended, then + * within the inner loop a non-atomic test is used to + * busywait with less bus contention for a good time to + * attempt to acquire the lock bit. + */ + preempt_disable(); +#ifdef CONFIG_SMP + while (test_and_set_bit(PG_chainlock, &page->flags)) { + while (test_bit(PG_chainlock, &page->flags)) + cpu_relax(); + } +#endif +} + +static inline void pte_chain_unlock(struct page *page) +{ +#ifdef CONFIG_SMP + smp_mb__before_clear_bit(); + clear_bit(PG_chainlock, &page->flags); +#endif + preempt_enable(); +} diff --git a/mm/rmap.c b/mm/rmap.c index 727e50efca39..5c98c1758dea 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -25,6 +25,7 @@ #include <linux/swapops.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/rmap-locking.h> #include <asm/pgalloc.h> #include <asm/rmap.h> diff --git a/mm/vmscan.c b/mm/vmscan.c index 41712a97b079..a00fe27159d9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -25,6 +25,7 @@ #include <linux/buffer_head.h> /* for try_to_release_page() */ #include <linux/mm_inline.h> #include <linux/pagevec.h> +#include <linux/rmap-locking.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> |
