From: Greg Kroah-Hartman Date: Fri, 14 Jun 2013 21:37:53 +0000 (-0700) Subject: 3.0-stable patches X-Git-Tag: v3.0.83~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa0c1e72bfe6bef20eca8bee716241e9b8d8edef;p=thirdparty%2Fkernel%2Fstable-queue.git 3.0-stable patches added patches: mm-migration-add-migrate_entry_wait_huge.patch x86-fix-typo-in-kexec-register-clearing.patch --- diff --git a/queue-3.0/mm-migration-add-migrate_entry_wait_huge.patch b/queue-3.0/mm-migration-add-migrate_entry_wait_huge.patch new file mode 100644 index 00000000000..fb94018d9db --- /dev/null +++ b/queue-3.0/mm-migration-add-migrate_entry_wait_huge.patch @@ -0,0 +1,109 @@ +From 30dad30922ccc733cfdbfe232090cf674dc374dc Mon Sep 17 00:00:00 2001 +From: Naoya Horiguchi +Date: Wed, 12 Jun 2013 14:05:04 -0700 +Subject: mm: migration: add migrate_entry_wait_huge() + +From: Naoya Horiguchi + +commit 30dad30922ccc733cfdbfe232090cf674dc374dc upstream. + +When we have a page fault for the address which is backed by a hugepage +under migration, the kernel can't wait correctly and do busy looping on +hugepage fault until the migration finishes. As a result, users who try +to kick hugepage migration (via soft offlining, for example) occasionally +experience long delay or soft lockup. + +This is because pte_offset_map_lock() can't get a correct migration entry +or a correct page table lock for hugepage. This patch introduces +migration_entry_wait_huge() to solve this. + +Signed-off-by: Naoya Horiguchi +Reviewed-by: Rik van Riel +Reviewed-by: Wanpeng Li +Reviewed-by: Michal Hocko +Cc: Mel Gorman +Cc: Andi Kleen +Cc: KOSAKI Motohiro +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/swapops.h | 3 +++ + mm/hugetlb.c | 2 +- + mm/migrate.c | 23 ++++++++++++++++++----- + 3 files changed, 22 insertions(+), 6 deletions(-) + +--- a/include/linux/swapops.h ++++ b/include/linux/swapops.h +@@ -113,6 +113,7 @@ static inline void make_migration_entry_ + + extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, + unsigned long address); ++extern void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte); + #else + + #define make_migration_entry(page, write) swp_entry(0, 0) +@@ -124,6 +125,8 @@ static inline int is_migration_entry(swp + static inline void make_migration_entry_read(swp_entry_t *entryp) { } + static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, + unsigned long address) { } ++static inline void migration_entry_wait_huge(struct mm_struct *mm, ++ pte_t *pte) { } + static inline int is_write_migration_entry(swp_entry_t entry) + { + return 0; +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -2662,7 +2662,7 @@ int hugetlb_fault(struct mm_struct *mm, + if (ptep) { + entry = huge_ptep_get(ptep); + if (unlikely(is_hugetlb_entry_migration(entry))) { +- migration_entry_wait(mm, (pmd_t *)ptep, address); ++ migration_entry_wait_huge(mm, ptep); + return 0; + } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) + return VM_FAULT_HWPOISON_LARGE | +--- a/mm/migrate.c ++++ b/mm/migrate.c +@@ -184,15 +184,14 @@ static void remove_migration_ptes(struct + * + * This function is called from do_swap_page(). + */ +-void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, +- unsigned long address) ++static void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, ++ spinlock_t *ptl) + { +- pte_t *ptep, pte; +- spinlock_t *ptl; ++ pte_t pte; + swp_entry_t entry; + struct page *page; + +- ptep = pte_offset_map_lock(mm, pmd, address, &ptl); ++ spin_lock(ptl); + pte = *ptep; + if (!is_swap_pte(pte)) + goto out; +@@ -220,6 +219,20 @@ out: + pte_unmap_unlock(ptep, ptl); + } + ++void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, ++ unsigned long address) ++{ ++ spinlock_t *ptl = pte_lockptr(mm, pmd); ++ pte_t *ptep = pte_offset_map(pmd, address); ++ __migration_entry_wait(mm, ptep, ptl); ++} ++ ++void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte) ++{ ++ spinlock_t *ptl = &(mm)->page_table_lock; ++ __migration_entry_wait(mm, pte, ptl); ++} ++ + #ifdef CONFIG_BLOCK + /* Returns true if all buffers are successfully locked */ + static bool buffer_migrate_lock_buffers(struct buffer_head *head, diff --git a/queue-3.0/series b/queue-3.0/series index 5c37f5a2964..01fa5a86150 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -2,3 +2,5 @@ b43-stop-format-string-leaking-into-error-msgs.patch ath9k-disable-powersave-by-default.patch drm-i915-prefer-vbt-modes-for-svdo-lvds-over-edid.patch swap-avoid-read_swap_cache_async-race-to-deadlock-while-waiting-on-discard-i-o-completion.patch +mm-migration-add-migrate_entry_wait_huge.patch +x86-fix-typo-in-kexec-register-clearing.patch diff --git a/queue-3.0/x86-fix-typo-in-kexec-register-clearing.patch b/queue-3.0/x86-fix-typo-in-kexec-register-clearing.patch new file mode 100644 index 00000000000..e7324048358 --- /dev/null +++ b/queue-3.0/x86-fix-typo-in-kexec-register-clearing.patch @@ -0,0 +1,33 @@ +From c8a22d19dd238ede87aa0ac4f7dbea8da039b9c1 Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Wed, 5 Jun 2013 11:47:18 -0700 +Subject: x86: Fix typo in kexec register clearing + +From: Kees Cook + +commit c8a22d19dd238ede87aa0ac4f7dbea8da039b9c1 upstream. + +Fixes a typo in register clearing code. Thanks to PaX Team for fixing +this originally, and James Troup for pointing it out. + +Signed-off-by: Kees Cook +Link: http://lkml.kernel.org/r/20130605184718.GA8396@www.outflux.net +Cc: PaX Team +Signed-off-by: H. Peter Anvin +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/relocate_kernel_64.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kernel/relocate_kernel_64.S ++++ b/arch/x86/kernel/relocate_kernel_64.S +@@ -160,7 +160,7 @@ identity_mapped: + xorq %rbp, %rbp + xorq %r8, %r8 + xorq %r9, %r9 +- xorq %r10, %r9 ++ xorq %r10, %r10 + xorq %r11, %r11 + xorq %r12, %r12 + xorq %r13, %r13