Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757954AbcK3Ob2 (ORCPT ); Wed, 30 Nov 2016 09:31:28 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44575 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757905AbcK3ObM (ORCPT ); Wed, 30 Nov 2016 09:31:12 -0500 Date: Wed, 30 Nov 2016 06:31:06 -0800 From: "Paul E. McKenney" To: Paul Menzel Cc: Michal Hocko , Donald Buczek , dvteam@molgen.mpg.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Josh Triplett Subject: Re: INFO: rcu_sched detected stalls on CPUs/tasks with `kswapd` and `mem_cgroup_shrink_node` Reply-To: paulmck@linux.vnet.ibm.com References: <68025f6c-6801-ab46-b0fc-a9407353d8ce@molgen.mpg.de> <20161124101525.GB20668@dhcp22.suse.cz> <583AA50A.9010608@molgen.mpg.de> <20161128110449.GK14788@dhcp22.suse.cz> <109d5128-f3a4-4b6e-db17-7a1fcb953500@molgen.mpg.de> <29196f89-c35e-f79d-8e4d-2bf73fe930df@molgen.mpg.de> <20161130110944.GD18432@dhcp22.suse.cz> <20161130115320.GO3924@linux.vnet.ibm.com> <20161130115442.GA19271@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16113014-0020-0000-0000-00000A650B15 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006168; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000193; SDB=6.00787385; UDB=6.00380869; IPR=6.00565064; BA=6.00004933; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013491; XFM=3.00000011; UTC=2016-11-30 14:31:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16113014-0021-0000-0000-000057B35D5C Message-Id: <20161130143106.GT3924@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-30_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611300240 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2328 Lines: 68 On Wed, Nov 30, 2016 at 01:31:37PM +0100, Paul Menzel wrote: > On 11/30/16 12:54, Paul E. McKenney wrote: > > On Wed, Nov 30, 2016 at 03:53:20AM -0800, Paul E. McKenney wrote: > >> On Wed, Nov 30, 2016 at 12:09:44PM +0100, Michal Hocko wrote: > >>> [CCing Paul] > >>> > >>> On Wed 30-11-16 11:28:34, Donald Buczek wrote: > >>> [...] > >>>> shrink_active_list gets and releases the spinlock and calls cond_resched(). > >>>> This should give other tasks a chance to run. Just as an experiment, I'm > >>>> trying > >>>> > >>>> --- a/mm/vmscan.c > >>>> +++ b/mm/vmscan.c > >>>> @@ -1921,7 +1921,7 @@ static void shrink_active_list(unsigned long > >>>> nr_to_scan, > >>>> spin_unlock_irq(&pgdat->lru_lock); > >>>> > >>>> while (!list_empty(&l_hold)) { > >>>> - cond_resched(); > >>>> + cond_resched_rcu_qs(); > >>>> page = lru_to_page(&l_hold); > >>>> list_del(&page->lru); > >>>> > >>>> and didn't hit a rcu_sched warning for >21 hours uptime now. We'll see. > >>> > >>> This is really interesting! Is it possible that the RCU stall detector > >>> is somehow confused? > >> > >> No, it is not confused. Again, cond_resched() is not a quiescent > >> state unless it does a context switch. Therefore, if the task running > >> in that loop was the only runnable task on its CPU, cond_resched() > >> would -never- provide RCU with a quiescent state. > >> > >> In contrast, cond_resched_rcu_qs() unconditionally provides RCU > >> with a quiescent state (hence the _rcu_qs in its name), regardless > >> of whether or not a context switch happens. > >> > >> It is therefore expected behavior that this change might prevent > >> RCU CPU stall warnings. > > > > I should add... This assumes that CONFIG_PREEMPT=n. So what is > > CONFIG_PREEMPT? > > It’s not selected. > > ``` > # CONFIG_PREEMPT is not set > ``` Thank you for the info! As noted elsewhere in this thread, there are other ways to get stalls, including the long irq-disabled execution that Michal suspects. Thanx, Paul > >>>> Is preemption disabled for another reason? > >>> > >>> I do not think so. I will have to double check the code but this is a > >>> standard sleepable context. Just wondering what is the PREEMPT > >>> configuration here? > > > Kind regards, > > Paul >