Received: by 10.223.185.116 with SMTP id b49csp6361703wrg; Wed, 28 Feb 2018 08:10:29 -0800 (PST) X-Google-Smtp-Source: AH8x224MdQ3RBxj0T1RVsHr8PW+fWjyvuXolauPrBG+/jHtARWijxh6liX8eNEiFZy7G4L+esxnR X-Received: by 10.99.125.22 with SMTP id y22mr14667471pgc.125.1519834229242; Wed, 28 Feb 2018 08:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519834229; cv=none; d=google.com; s=arc-20160816; b=tq1J1FGwkywk55UDdSjjXO5tpt5BWNuawA37KUPYLhsos0kegHxe3t34fpj2THjutf E6S9dHce1EuKhCsQrOMDbk76q+Xc4in4ZKH61BN36u1CbpSMt0aTipW1jj5AUDnAUY9O rTsQqY5uP1KQ5PCS0CASojWfaRbvja2gXwdujxN/VvHHRGVwvDZn1upc5g/BiTBcnn1u Wumn07xVQvmBWzQSPDx7OmhiXfBQ+BEMMMCs/wDUiTnJdmNWVrLjYrn5K69x73aLZR37 FutA7gnTM5CrhK+008tN9MMWOrEJIXB/bCwuH/wt7HmwHgcpWbpHzFr8gunkwiJ2XhsI MJyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=qLMynzppgZVieDT6P3MNMaJzQlZYmpJ4HmWfVY/R7aU=; b=y2PeW6TAYgvaqi3bDEDlSst+1OghKCvwE+bC6ZHfh5JZymOr7r7+J6ECBEEbdvlxYX mWZUSaYOokhs4DDclTzA3vzadJmPJUw5NztAF6eHMxZQhFiCQ4Q5WH5/96Q/H/nGKwUx 2p5s2uaMFyPrb1zW+wCi0BJbQu66HElubgj84VHZK6vik6comB2uMnksr0lpL4OfMlF8 P8dWggIqsKkFup4OiQSDWISpVPIdWs7+BzNNN82XBKDeCFle73oQxFKc7neqn7gqrfaP F4YxjNT1zBYZuLcfupfdT1qpkJQgJOR/Lea7kkUh7uCZfdpWy+3PNh7sD3P1ZdPWVJM4 vAcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si1405741pff.8.2018.02.28.08.10.14; Wed, 28 Feb 2018 08:10:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753106AbeB1QId (ORCPT + 99 others); Wed, 28 Feb 2018 11:08:33 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34953 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934474AbeB1QI3 (ORCPT ); Wed, 28 Feb 2018 11:08:29 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yj-0006Xi-Lq; Wed, 28 Feb 2018 15:22:22 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yi-0000Bz-Ip; Wed, 28 Feb 2018 15:22:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Linus Torvalds" , "Nicholas Piggin" , "Anshuman Khandual" , "Michal Hocko" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 170/254] mm/mprotect: add a cond_resched() inside change_pmd_range() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Anshuman Khandual 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 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 Suggested-by: Nicholas Piggin Acked-by: Michal Hocko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- mm/mprotect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -152,7 +152,7 @@ static inline unsigned long change_pmd_r next = pmd_addr_end(addr, end); if (!pmd_trans_huge(*pmd) && pmd_none_or_clear_bad(pmd)) - continue; + goto next; /* invoke the mmu notifier if the pmd is populated */ if (!mni_start) { @@ -174,7 +174,7 @@ static inline unsigned long change_pmd_r } /* huge pmd was handled */ - continue; + goto next; } } /* fall through, the trans huge pmd just split */ @@ -182,6 +182,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)