diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 1c1207472bb4..a5c451816fdc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _LINUX_MM_H | 2 | #define _LINUX_MM_H |
3 | 3 | ||
4 | #include <linux/errno.h> | 4 | #include <linux/errno.h> |
5 | #include <linux/capability.h> | ||
6 | 5 | ||
7 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
8 | 7 | ||
@@ -27,7 +26,6 @@ extern unsigned long max_mapnr; | |||
27 | 26 | ||
28 | extern unsigned long num_physpages; | 27 | extern unsigned long num_physpages; |
29 | extern void * high_memory; | 28 | extern void * high_memory; |
30 | extern unsigned long vmalloc_earlyreserve; | ||
31 | extern int page_cluster; | 29 | extern int page_cluster; |
32 | 30 | ||
33 | #ifdef CONFIG_SYSCTL | 31 | #ifdef CONFIG_SYSCTL |
@@ -601,6 +599,7 @@ static inline struct address_space *page_mapping(struct page *page) | |||
601 | { | 599 | { |
602 | struct address_space *mapping = page->mapping; | 600 | struct address_space *mapping = page->mapping; |
603 | 601 | ||
602 | VM_BUG_ON(PageSlab(page)); | ||
604 | if (unlikely(PageSwapCache(page))) | 603 | if (unlikely(PageSwapCache(page))) |
605 | mapping = &swapper_space; | 604 | mapping = &swapper_space; |
606 | #ifdef CONFIG_SLUB | 605 | #ifdef CONFIG_SLUB |
@@ -812,27 +811,31 @@ extern unsigned long do_mremap(unsigned long addr, | |||
812 | unsigned long flags, unsigned long new_addr); | 811 | unsigned long flags, unsigned long new_addr); |
813 | 812 | ||
814 | /* | 813 | /* |
815 | * Prototype to add a shrinker callback for ageable caches. | 814 | * A callback you can register to apply pressure to ageable caches. |
816 | * | ||
817 | * These functions are passed a count `nr_to_scan' and a gfpmask. They should | ||
818 | * scan `nr_to_scan' objects, attempting to free them. | ||
819 | * | 815 | * |
820 | * The callback must return the number of objects which remain in the cache. | 816 | * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should |
817 | * look through the least-recently-used 'nr_to_scan' entries and | ||
818 | * attempt to free them up. It should return the number of objects | ||
819 | * which remain in the cache. If it returns -1, it means it cannot do | ||
820 | * any scanning at this time (eg. there is a risk of deadlock). | ||
821 | * | 821 | * |
822 | * The callback will be passed nr_to_scan == 0 when the VM is querying the | 822 | * The 'gfpmask' refers to the allocation we are currently trying to |
823 | * cache size, so a fastpath for that case is appropriate. | 823 | * fulfil. |
824 | */ | 824 | * |
825 | typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask); | 825 | * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is |
826 | 826 | * querying the cache size, so a fastpath for that case is appropriate. | |
827 | /* | ||
828 | * Add an aging callback. The int is the number of 'seeks' it takes | ||
829 | * to recreate one of the objects that these functions age. | ||
830 | */ | 827 | */ |
828 | struct shrinker { | ||
829 | int (*shrink)(int nr_to_scan, gfp_t gfp_mask); | ||
830 | int seeks; /* seeks to recreate an obj */ | ||
831 | 831 | ||
832 | #define DEFAULT_SEEKS 2 | 832 | /* These are for internal use */ |
833 | struct shrinker; | 833 | struct list_head list; |
834 | extern struct shrinker *set_shrinker(int, shrinker_t); | 834 | long nr; /* objs pending delete */ |
835 | extern void remove_shrinker(struct shrinker *shrinker); | 835 | }; |
836 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ | ||
837 | extern void register_shrinker(struct shrinker *); | ||
838 | extern void unregister_shrinker(struct shrinker *); | ||
836 | 839 | ||
837 | /* | 840 | /* |
838 | * Some shared mappigns will want the pages marked read-only | 841 | * Some shared mappigns will want the pages marked read-only |
@@ -1072,6 +1075,10 @@ extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned lo | |||
1072 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | 1075 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, |
1073 | unsigned long len, unsigned long prot, | 1076 | unsigned long len, unsigned long prot, |
1074 | unsigned long flag, unsigned long pgoff); | 1077 | unsigned long flag, unsigned long pgoff); |
1078 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | ||
1079 | unsigned long len, unsigned long flags, | ||
1080 | unsigned int vm_flags, unsigned long pgoff, | ||
1081 | int accountable); | ||
1075 | 1082 | ||
1076 | static inline unsigned long do_mmap(struct file *file, unsigned long addr, | 1083 | static inline unsigned long do_mmap(struct file *file, unsigned long addr, |
1077 | unsigned long len, unsigned long prot, | 1084 | unsigned long len, unsigned long prot, |