diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-30 20:16:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-30 20:16:36 -0400 |
| commit | 4d0bd657d77d599307649aa03991b05e3ddef059 (patch) | |
| tree | a1b028afe393695ea8ccbe4a2ef7742b94d82ef7 /mm/memory.c | |
| parent | 26bcd8b72563b4c54892c4c2a409f6656fb8ae8b (diff) | |
| parent | e0198b290dcd8313bdf313a0d083033d5c01d761 (diff) | |
Merge branch 'akpm' (patches from Andrew Morton)
Merge fixes from Andrew Morton:
"10 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
Josh has moved
kexec: export free_huge_page to VMCOREINFO
mm: fix filemap.c pagecache_get_page() kernel-doc warnings
mm: debugfs: move rounddown_pow_of_two() out from do_fault path
memcg: oom_notify use-after-free fix
hwpoison: call action_result() in failure path of hwpoison_user_mappings()
hwpoison: fix hugetlbfs/thp precheck in hwpoison_user_mappings()
rapidio/tsi721_dma: fix failure to obtain transaction descriptor
mm, thp: do not allow thp faults to avoid cpuset restrictions
mm/page-writeback.c: fix divide by zero in bdi_dirty_limits()
Diffstat (limited to 'mm/memory.c')
| -rw-r--r-- | mm/memory.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/mm/memory.c b/mm/memory.c index 7e8d8205b610..8b44f765b645 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -2758,23 +2758,18 @@ void do_set_pte(struct vm_area_struct *vma, unsigned long address, | |||
| 2758 | update_mmu_cache(vma, address, pte); | 2758 | update_mmu_cache(vma, address, pte); |
| 2759 | } | 2759 | } |
| 2760 | 2760 | ||
| 2761 | static unsigned long fault_around_bytes = 65536; | 2761 | static unsigned long fault_around_bytes = rounddown_pow_of_two(65536); |
| 2762 | 2762 | ||
| 2763 | /* | ||
| 2764 | * fault_around_pages() and fault_around_mask() round down fault_around_bytes | ||
| 2765 | * to nearest page order. It's what do_fault_around() expects to see. | ||
| 2766 | */ | ||
| 2767 | static inline unsigned long fault_around_pages(void) | 2763 | static inline unsigned long fault_around_pages(void) |
| 2768 | { | 2764 | { |
| 2769 | return rounddown_pow_of_two(fault_around_bytes) / PAGE_SIZE; | 2765 | return fault_around_bytes >> PAGE_SHIFT; |
| 2770 | } | 2766 | } |
| 2771 | 2767 | ||
| 2772 | static inline unsigned long fault_around_mask(void) | 2768 | static inline unsigned long fault_around_mask(void) |
| 2773 | { | 2769 | { |
| 2774 | return ~(rounddown_pow_of_two(fault_around_bytes) - 1) & PAGE_MASK; | 2770 | return ~(fault_around_bytes - 1) & PAGE_MASK; |
| 2775 | } | 2771 | } |
| 2776 | 2772 | ||
| 2777 | |||
| 2778 | #ifdef CONFIG_DEBUG_FS | 2773 | #ifdef CONFIG_DEBUG_FS |
| 2779 | static int fault_around_bytes_get(void *data, u64 *val) | 2774 | static int fault_around_bytes_get(void *data, u64 *val) |
| 2780 | { | 2775 | { |
| @@ -2782,11 +2777,19 @@ static int fault_around_bytes_get(void *data, u64 *val) | |||
| 2782 | return 0; | 2777 | return 0; |
| 2783 | } | 2778 | } |
| 2784 | 2779 | ||
| 2780 | /* | ||
| 2781 | * fault_around_pages() and fault_around_mask() expects fault_around_bytes | ||
| 2782 | * rounded down to nearest page order. It's what do_fault_around() expects to | ||
| 2783 | * see. | ||
| 2784 | */ | ||
| 2785 | static int fault_around_bytes_set(void *data, u64 val) | 2785 | static int fault_around_bytes_set(void *data, u64 val) |
| 2786 | { | 2786 | { |
| 2787 | if (val / PAGE_SIZE > PTRS_PER_PTE) | 2787 | if (val / PAGE_SIZE > PTRS_PER_PTE) |
| 2788 | return -EINVAL; | 2788 | return -EINVAL; |
| 2789 | fault_around_bytes = val; | 2789 | if (val > PAGE_SIZE) |
| 2790 | fault_around_bytes = rounddown_pow_of_two(val); | ||
| 2791 | else | ||
| 2792 | fault_around_bytes = PAGE_SIZE; /* rounddown_pow_of_two(0) is undefined */ | ||
| 2790 | return 0; | 2793 | return 0; |
| 2791 | } | 2794 | } |
| 2792 | DEFINE_SIMPLE_ATTRIBUTE(fault_around_bytes_fops, | 2795 | DEFINE_SIMPLE_ATTRIBUTE(fault_around_bytes_fops, |
