diff options
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/security.h> | 7 | #include <linux/security.h> |
8 | #include <linux/swap.h> | ||
8 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
9 | 10 | ||
10 | #include "internal.h" | 11 | #include "internal.h" |
@@ -382,6 +383,21 @@ unsigned long vm_mmap(struct file *file, unsigned long addr, | |||
382 | } | 383 | } |
383 | EXPORT_SYMBOL(vm_mmap); | 384 | EXPORT_SYMBOL(vm_mmap); |
384 | 385 | ||
386 | struct address_space *page_mapping(struct page *page) | ||
387 | { | ||
388 | struct address_space *mapping = page->mapping; | ||
389 | |||
390 | VM_BUG_ON(PageSlab(page)); | ||
391 | #ifdef CONFIG_SWAP | ||
392 | if (unlikely(PageSwapCache(page))) | ||
393 | mapping = &swapper_space; | ||
394 | else | ||
395 | #endif | ||
396 | if ((unsigned long)mapping & PAGE_MAPPING_ANON) | ||
397 | mapping = NULL; | ||
398 | return mapping; | ||
399 | } | ||
400 | |||
385 | /* Tracepoints definitions. */ | 401 | /* Tracepoints definitions. */ |
386 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); | 402 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); |
387 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); | 403 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); |