Commit 9800339b5e0f0e24ab3dac349e0de80d2018832e
Committed by
Linus Torvalds
1 parent
340ef3902c
Exists in
master
and in
20 other branches
mm: don't inline page_mapping()
According to akpm, this saves 1/2k text and makes things simple for the next patch. Numbers from Minchan: add/remove: 1/0 grow/shrink: 6/22 up/down: 92/-516 (-424) function old new delta page_mapping - 48 +48 do_task_stat 2292 2308 +16 page_remove_rmap 240 248 +8 load_elf_binary 4500 4508 +8 update_queue 532 536 +4 scsi_probe_and_add_lun 2892 2896 +4 lookup_fast 644 648 +4 vcs_read 1040 1036 -4 __ip_route_output_key 1904 1900 -4 ip_route_input_noref 2508 2500 -8 shmem_file_aio_read 784 772 -12 __isolate_lru_page 272 256 -16 shmem_replace_page 708 688 -20 mark_buffer_dirty 228 208 -20 __set_page_dirty_buffers 240 220 -20 __remove_mapping 276 256 -20 update_mmu_cache 500 476 -24 set_page_dirty_balance 92 68 -24 set_page_dirty 172 148 -24 page_evictable 88 64 -24 page_cache_pipe_buf_steal 248 224 -24 clear_page_dirty_for_io 340 316 -24 test_set_page_writeback 400 372 -28 test_clear_page_writeback 516 488 -28 invalidate_inode_page 156 128 -28 page_mkclean 432 400 -32 flush_dcache_page 360 328 -32 __set_page_dirty_nobuffers 324 280 -44 shrink_page_list 2412 2356 -56 Signed-off-by: Shaohua Li <shli@fusionio.com> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Cc: Hugh Dickins <hughd@google.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: Minchan Kim <minchan.kim@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 17 additions and 12 deletions Side-by-side Diff
include/linux/mm.h
... | ... | @@ -809,18 +809,7 @@ |
809 | 809 | #define PAGE_MAPPING_KSM 2 |
810 | 810 | #define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) |
811 | 811 | |
812 | -extern struct address_space swapper_space; | |
813 | -static inline struct address_space *page_mapping(struct page *page) | |
814 | -{ | |
815 | - struct address_space *mapping = page->mapping; | |
816 | - | |
817 | - VM_BUG_ON(PageSlab(page)); | |
818 | - if (unlikely(PageSwapCache(page))) | |
819 | - mapping = &swapper_space; | |
820 | - else if ((unsigned long)mapping & PAGE_MAPPING_ANON) | |
821 | - mapping = NULL; | |
822 | - return mapping; | |
823 | -} | |
812 | +extern struct address_space *page_mapping(struct page *page); | |
824 | 813 | |
825 | 814 | /* Neutral page->mapping pointer to address_space or anon_vma or other */ |
826 | 815 | static inline void *page_rmapping(struct page *page) |
mm/util.c
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | #include <linux/err.h> |
6 | 6 | #include <linux/sched.h> |
7 | 7 | #include <linux/security.h> |
8 | +#include <linux/swap.h> | |
8 | 9 | #include <asm/uaccess.h> |
9 | 10 | |
10 | 11 | #include "internal.h" |
... | ... | @@ -381,6 +382,21 @@ |
381 | 382 | return vm_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); |
382 | 383 | } |
383 | 384 | EXPORT_SYMBOL(vm_mmap); |
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 | +} | |
384 | 400 | |
385 | 401 | /* Tracepoints definitions. */ |
386 | 402 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); |