ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / rmap.h
1 #ifndef _LINUX_RMAP_H
2 #define _LINUX_RMAP_H
3 /*
4  * Declarations for Reverse Mapping functions in mm/rmap.c
5  * Its structures are declared within that file.
6  */
7
8 #include <linux/config.h>
9 #include <linux/linkage.h>
10
11 #define rmap_lock(page) \
12         bit_spin_lock(PG_maplock, (unsigned long *)&(page)->flags)
13 #define rmap_unlock(page) \
14         bit_spin_unlock(PG_maplock, (unsigned long *)&(page)->flags)
15
16 #ifdef CONFIG_MMU
17
18 struct pte_chain;
19 struct pte_chain *pte_chain_alloc(int gfp_flags);
20 void __pte_chain_free(struct pte_chain *pte_chain);
21
22 static inline void pte_chain_free(struct pte_chain *pte_chain)
23 {
24         if (pte_chain)
25                 __pte_chain_free(pte_chain);
26 }
27
28 struct pte_chain * fastcall
29         page_add_rmap(struct page *, pte_t *, struct pte_chain *);
30 void fastcall page_remove_rmap(struct page *, pte_t *);
31
32 /*
33  * Called from mm/vmscan.c to handle paging out
34  */
35 int fastcall page_referenced(struct page *);
36 int fastcall try_to_unmap(struct page *);
37
38 #else   /* !CONFIG_MMU */
39
40 #define page_referenced(page)   TestClearPageReferenced(page)
41 #define try_to_unmap(page)      SWAP_FAIL
42
43 #endif  /* CONFIG_MMU */
44
45 /*
46  * Return values of try_to_unmap
47  */
48 #define SWAP_SUCCESS    0
49 #define SWAP_AGAIN      1
50 #define SWAP_FAIL       2
51
52 #endif  /* _LINUX_RMAP_H */