From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2C0BC43457 for ; Fri, 16 Oct 2020 13:02:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2BF5D207DE for ; Fri, 16 Oct 2020 13:02:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="aPkBWMe/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF5D207DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3C927940008; Fri, 16 Oct 2020 09:02:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 379D4900002; Fri, 16 Oct 2020 09:02:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28F89940008; Fri, 16 Oct 2020 09:02:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 0FEE4900002 for ; Fri, 16 Oct 2020 09:02:11 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B60F1180AD81D for ; Fri, 16 Oct 2020 13:02:10 +0000 (UTC) X-FDA: 77377801620.11.soda86_5715e6f2721d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 834F2180F8B82 for ; Fri, 16 Oct 2020 13:02:10 +0000 (UTC) X-HE-Tag: soda86_5715e6f2721d X-Filterd-Recvd-Size: 3874 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 16 Oct 2020 13:02:09 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602853329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nGU+TiofL4Z7acFZTrz/FX0B5HKwXBlKH6gf2iGwsNU=; b=aPkBWMe/Mj0XautSxavMJ72BaVq/i6YfnnmycBdFQgPbeb5UoWZSsXjBJC7wuSazIkxpVz tHgtPiwkq+rtUgvRxXdAXXc1Jr6tdUlTM/aAuGRL4XPI1y1WIckpMsVhgIb0n1rLkVEUZa olrZr95ofMtI2Mq2RCWfGkZAjsnZiRk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DCAB8B11D; Fri, 16 Oct 2020 13:02:08 +0000 (UTC) Date: Fri, 16 Oct 2020 15:02:08 +0200 From: Michal Hocko To: Tianxianting Cc: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mm: vmscan: avoid a unnecessary reschedule in shrink_slab() Message-ID: <20201016130208.GI22589@dhcp22.suse.cz> References: <20201016033952.1924-1-tian.xianting@h3c.com> <20201016120749.GG22589@dhcp22.suse.cz> <9a2b772b13f84bdd9517b17d8d72aa89@h3c.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a2b772b13f84bdd9517b17d8d72aa89@h3c.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 16-10-20 12:48:23, Tianxianting wrote: > Thanks, my understanding is, > In shrink_slab(), do_shrink_slab() will do the real reclaim work, which will occupy current cpu and consume more cpu time, so we need to trigger a reschedule after reclaim. > But if it jumps to 'out' label, that means we don't do the reclaim work at this time, it won't cause other thread getting starvation, so we don't need to call cond_resched() in this case. > Is it right? You are almost right. But consider situation when the lock is taken for quite some time. do_shrink_slab cannot make any forward progress and effectivelly busy loop. Unless the caller does cond_resched it might cause soft lockups. Anyway let me try to ask again. Why does would this be any problem that deserves a fix? > > -----Original Message----- > From: Michal Hocko [mailto:mhocko@suse.com] > Sent: Friday, October 16, 2020 8:08 PM > To: tianxianting (RD) > Cc: akpm@linux-foundation.org; linux-mm@kvack.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] mm: vmscan: avoid a unnecessary reschedule in shrink_slab() > > On Fri 16-10-20 11:39:52, Xianting Tian wrote: > > In shrink_slab(), it directly goes to 'out' label only when it can't > > get the lock of shrinker_rwsew. In this case, it doesn't do the real > > work of shrinking slab, so we don't need trigger a reschedule by > > cond_resched(). > > Your changelog doesn't explain why this is not needed or undesirable. Do you see any actual problem? > > The point of this code is to provide a deterministic scheduling point regardless of the shrinker_rwsew. > > > > > Signed-off-by: Xianting Tian > > --- > > mm/vmscan.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c index 466fc3144..676e97b28 > > 100644 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -687,8 +687,9 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, > > } > > > > up_read(&shrinker_rwsem); > > -out: > > + > > cond_resched(); > > +out: > > return freed; > > } > > > > -- > > 2.17.1 > > > > -- > Michal Hocko > SUSE Labs -- Michal Hocko SUSE Labs