stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.14 09/38] mm/mprotect: add a cond_resched() inside change_pmd_range()
Date: Mon,  8 Jan 2018 13:59:02 +0100	[thread overview]
Message-ID: <20180108125916.560507865@linuxfoundation.org> (raw)
In-Reply-To: <20180108125915.951963528@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anshuman Khandual <khandual@linux.vnet.ibm.com>

commit 4991c09c7c812dba13ea9be79a68b4565bb1fa4e upstream.

While testing on a large CPU system, detected the following RCU stall
many times over the span of the workload.  This problem is solved by
adding a cond_resched() in the change_pmd_range() function.

  INFO: rcu_sched detected stalls on CPUs/tasks:
   154-....: (670 ticks this GP) idle=022/140000000000000/0 softirq=2825/2825 fqs=612
   (detected by 955, t=6002 jiffies, g=4486, c=4485, q=90864)
  Sending NMI from CPU 955 to CPUs 154:
  NMI backtrace for cpu 154
  CPU: 154 PID: 147071 Comm: workload Not tainted 4.15.0-rc3+ #3
  NIP:  c0000000000b3f64 LR: c0000000000b33d4 CTR: 000000000000aa18
  REGS: 00000000a4b0fb44 TRAP: 0501   Not tainted  (4.15.0-rc3+)
  MSR:  8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 22422082  XER: 00000000
  CFAR: 00000000006cf8f0 SOFTE: 1
  GPR00: 0010000000000000 c00003ef9b1cb8c0 c0000000010cc600 0000000000000000
  GPR04: 8e0000018c32b200 40017b3858fd6e00 8e0000018c32b208 40017b3858fd6e00
  GPR08: 8e0000018c32b210 40017b3858fd6e00 8e0000018c32b218 40017b3858fd6e00
  GPR12: ffffffffffffffff c00000000fb25100
  NIP [c0000000000b3f64] plpar_hcall9+0x44/0x7c
  LR [c0000000000b33d4] pSeries_lpar_flush_hash_range+0x384/0x420
  Call Trace:
    flush_hash_range+0x48/0x100
    __flush_tlb_pending+0x44/0xd0
    hpte_need_flush+0x408/0x470
    change_protection_range+0xaac/0xf10
    change_prot_numa+0x30/0xb0
    task_numa_work+0x2d0/0x3e0
    task_work_run+0x130/0x190
    do_notify_resume+0x118/0x120
    ret_from_except_lite+0x70/0x74
  Instruction dump:
  60000000 f8810028 7ca42b78 7cc53378 7ce63b78 7d074378 7d284b78 7d495378
  e9410060 e9610068 e9810070 44000022 <7d806378> e9810028 f88c0000 f8ac0008

Link: http://lkml.kernel.org/r/20171214140551.5794-1-khandual@linux.vnet.ibm.com
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/mprotect.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -166,7 +166,7 @@ static inline unsigned long change_pmd_r
 		next = pmd_addr_end(addr, end);
 		if (!is_swap_pmd(*pmd) && !pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)
 				&& pmd_none_or_clear_bad(pmd))
-			continue;
+			goto next;
 
 		/* invoke the mmu notifier if the pmd is populated */
 		if (!mni_start) {
@@ -188,7 +188,7 @@ static inline unsigned long change_pmd_r
 					}
 
 					/* huge pmd was handled */
-					continue;
+					goto next;
 				}
 			}
 			/* fall through, the trans huge pmd just split */
@@ -196,6 +196,8 @@ static inline unsigned long change_pmd_r
 		this_pages = change_pte_range(vma, pmd, addr, next, newprot,
 				 dirty_accountable, prot_numa);
 		pages += this_pages;
+next:
+		cond_resched();
 	} while (pmd++, addr = next, addr != end);
 
 	if (mni_start)

  parent reply	other threads:[~2018-01-08 12:59 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 12:58 [PATCH 4.14 00/38] 4.14.13-stable review Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 01/38] x86/mm: Set MODULES_END to 0xffffffffff000000 Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 02/38] x86/mm: Map cpu_entry_area at the same place on 4/5 level Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 03/38] x86/kaslr: Fix the vaddr_end mess Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 04/38] x86/events/intel/ds: Use the proper cache flush method for mapping ds buffers Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 05/38] x86/tlb: Drop the _GPL from the cpu_tlbstate export Greg Kroah-Hartman
2018-01-08 12:58 ` [PATCH 4.14 06/38] x86/alternatives: Add missing \n at end of ALTERNATIVE inline asm Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 07/38] x86/pti: Rename BUG_CPU_INSECURE to BUG_CPU_MELTDOWN Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 08/38] kernel/acct.c: fix the acct->needcheck check in check_free_space() Greg Kroah-Hartman
2018-01-08 12:59 ` Greg Kroah-Hartman [this message]
2018-01-08 12:59 ` [PATCH 4.14 10/38] mm/sparse.c: wrong allocation for mem_section Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 11/38] userfaultfd: clear the vma->vm_userfaultfd_ctx if UFFD_EVENT_FORK fails Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 12/38] btrfs: fix refcount_t usage when deleting btrfs_delayed_nodes Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 13/38] efi/capsule-loader: Reinstate virtual capsule mapping Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 14/38] crypto: n2 - cure use after free Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 15/38] crypto: chacha20poly1305 - validate the digest size Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 16/38] crypto: pcrypt - fix freeing pcrypt instances Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 17/38] crypto: chelsio - select CRYPTO_GF128MUL Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 21/38] fscache: Fix the default for fscache_maybe_release_page() Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 22/38] x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu() Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 23/38] x86 / CPU: Always show current CPU frequency in /proc/cpuinfo Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 24/38] kernel/signal.c: protect the traced SIGNAL_UNKILLABLE tasks from SIGKILL Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 25/38] kernel/signal.c: protect the SIGNAL_UNKILLABLE tasks from !sig_kernel_only() signals Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 26/38] kernel/signal.c: remove the no longer needed SIGNAL_UNKILLABLE check in complete_signal() Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 27/38] iommu/arm-smmu-v3: Dont free page table ops twice Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 28/38] iommu/arm-smmu-v3: Cope with duplicated Stream IDs Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 29/38] ARC: uaccess: dont use "l" gcc inline asm constraint modifier Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 30/38] powerpc/mm: Fix SEGV on mapped region to return SEGV_ACCERR Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 31/38] Input: elantech - add new icbody type 15 Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 32/38] x86/microcode/AMD: Add support for fam17h microcode loading Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 34/38] parisc: Fix alignment of pa_tlb_lock in assembly on 32-bit SMP kernel Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 35/38] parisc: qemu idle sleep support Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 37/38] KVM: s390: fix cmma migration for multiple memory slots Greg Kroah-Hartman
2018-01-08 12:59 ` [PATCH 4.14 38/38] KVM: s390: prevent buffer overrun on memory hotplug during migration Greg Kroah-Hartman
2018-01-08 20:59 ` [PATCH 4.14 00/38] 4.14.13-stable review Shuah Khan
2018-01-09  9:11   ` Greg Kroah-Hartman
2018-01-09  8:45 ` Naresh Kamboju
2018-01-09  9:27   ` Greg Kroah-Hartman
2018-01-09 13:45 ` Guenter Roeck
2018-01-09 19:07   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180108125916.560507865@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=npiggin@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).