Commit 11bf19bc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent ef5bf0b5
......@@ -228,36 +228,6 @@ extern void get_page_state(struct page_state *ret);
#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
*/
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.
......
/*
* 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();
}
......@@ -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>
......
......@@ -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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment