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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 1DFBDC433EF for ; Wed, 22 Sep 2021 08:03:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E3A86124A for ; Wed, 22 Sep 2021 08:03:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6E3A86124A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id D9D616B006C; Wed, 22 Sep 2021 04:03:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4D686B0072; Wed, 22 Sep 2021 04:03:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3CF76B0073; Wed, 22 Sep 2021 04:03:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id B48BF6B006C for ; Wed, 22 Sep 2021 04:03:55 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 64E372B35E for ; Wed, 22 Sep 2021 08:03:55 +0000 (UTC) X-FDA: 78614470830.05.0210AF2 Received: from outbound-smtp14.blacknight.com (outbound-smtp14.blacknight.com [46.22.139.231]) by imf03.hostedemail.com (Postfix) with ESMTP id BE75C30000A6 for ; Wed, 22 Sep 2021 08:03:54 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp14.blacknight.com (Postfix) with ESMTPS id 32C521C49C6 for ; Wed, 22 Sep 2021 09:03:53 +0100 (IST) Received: (qmail 15258 invoked from network); 22 Sep 2021 08:03:53 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 22 Sep 2021 08:03:52 -0000 Date: Wed, 22 Sep 2021 09:03:51 +0100 From: Mel Gorman To: Dave Chinner Cc: NeilBrown , Linux-MM , Theodore Ts'o , Andreas Dilger , "Darrick J . Wong" , Matthew Wilcox , Michal Hocko , Rik van Riel , Vlastimil Babka , Johannes Weiner , Jonathan Corbet , Linux-fsdevel , LKML Subject: Re: [PATCH 1/5] mm/vmscan: Throttle reclaim until some writeback completes if congested Message-ID: <20210922080351.GU3959@techsingularity.net> References: <20210920085436.20939-1-mgorman@techsingularity.net> <20210920085436.20939-2-mgorman@techsingularity.net> <163218319798.3992.1165186037496786892@noble.neil.brown.name> <20210921105831.GO3959@techsingularity.net> <20210922060447.GA2361455@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210922060447.GA2361455@dread.disaster.area> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BE75C30000A6 X-Stat-Signature: 59dpo3jm915raddcg9nwfmktuqezt96n Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.231 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-HE-Tag: 1632297834-395664 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 Wed, Sep 22, 2021 at 04:04:47PM +1000, Dave Chinner wrote: > On Tue, Sep 21, 2021 at 11:58:31AM +0100, Mel Gorman wrote: > > On Tue, Sep 21, 2021 at 10:13:17AM +1000, NeilBrown wrote: > > > On Mon, 20 Sep 2021, Mel Gorman wrote: > > > > -long wait_iff_congested(int sync, long timeout) > > > > -{ > > > > - long ret; > > > > - unsigned long start = jiffies; > > > > - DEFINE_WAIT(wait); > > > > - wait_queue_head_t *wqh = &congestion_wqh[sync]; > > > > - > > > > - /* > > > > - * If there is no congestion, yield if necessary instead > > > > - * of sleeping on the congestion queue > > > > - */ > > > > - if (atomic_read(&nr_wb_congested[sync]) == 0) { > > > > - cond_resched(); > > > > - > > > > - /* In case we scheduled, work out time remaining */ > > > > - ret = timeout - (jiffies - start); > > > > - if (ret < 0) > > > > - ret = 0; > > > > - > > > > - goto out; > > > > - } > > > > - > > > > - /* Sleep until uncongested or a write happens */ > > > > - prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); > > > > > > Uninterruptible wait. > > > > > > .... > > > > +static void > > > > +reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason, > > > > + long timeout) > > > > +{ > > > > + wait_queue_head_t *wqh = &pgdat->reclaim_wait; > > > > + unsigned long start = jiffies; > > > > + long ret; > > > > + DEFINE_WAIT(wait); > > > > + > > > > + atomic_inc(&pgdat->nr_reclaim_throttled); > > > > + WRITE_ONCE(pgdat->nr_reclaim_start, > > > > + node_page_state(pgdat, NR_THROTTLED_WRITTEN)); > > > > + > > > > + prepare_to_wait(wqh, &wait, TASK_INTERRUPTIBLE); > > > > > > Interruptible wait. > > > > > > Why the change? I think these waits really need to be TASK_UNINTERRUPTIBLE. > > > > > > > Because from mm/ context, I saw no reason why the task *should* be > > uninterruptible. It's waiting on other tasks to complete IO and it is not > > protecting device state, filesystem state or anything else. If it gets > > a signal, it's safe to wake up, particularly if that signal is KILL and > > the context is a direct reclaimer. > > I disagree. whether the sleep should be interruptable or > not is entirely dependent on whether the caller can handle failure > or not. If this is GFP_NOFAIL, allocation must not fail no matter > what the context is, so signals and the like are irrelevant. > > For a context that can handle allocation failure, then it makes > sense to wake on events that will result in the allocation failing > immediately. But if all this does is make the allocation code go > around another retry loop sooner, then an interruptible sleep still > doesn't make any sense at all here... > Ok, between this and Neil's mail on the same topic, I'm convinced. -- Mel Gorman SUSE Labs