Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp254574pxb; Wed, 22 Sep 2021 01:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhFg5fBhSBLbUaX9JNX3w9TmYSuK+PhUMF0ihM2UOAAglKwueKoRFWAk3U7qPEcpLeVcQ2 X-Received: by 2002:a50:9d42:: with SMTP id j2mr10398000edk.7.1632298080926; Wed, 22 Sep 2021 01:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632298080; cv=none; d=google.com; s=arc-20160816; b=J6DLkvZtK9BZ78Nm0/MzlQKdpQXWgsIYXUANiEVA5c2Ikp2FJgM1ft1VAvMzuon6X9 W/4K4Wp+4sLhJYhyFdQcZSRSyExjCxu53g8OWpLEjX/5KDYeLZ4Xlk/cOenjslYWFLdH f++kSgJAe76sBwpxzRQ4/icTBpGozwHsTx5QEeFxK64cJfzZocrpg1QvLDyctXZ51neB Lu3DQIcZW1c3+F6dd+X0ifTaJApYC496G2hMIRPXu/J1zbDdbx/TFJZa31bG8f5Hm7SD U3vHfAIsnS3AnkrL2qSLSWlUjxzvSgOZE3qifkDJYQYB/DGZh9BALLnbrMRI7LCeO8qy el5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=F2rUJL/lm5en5KVEwC0NiUQS77/Ve3QIl458fXvb6Hw=; b=k/Wa5fJWLYr7BOs/CUvdWKJDzQ7Bmt/qu8HFdw5Z0D0kzXkw/8pfKSxZ1XBq57Dhl2 B2b4oQLuOLT6irV2nFW9U2KQPof9O45gIl6dSH+G5Ph0kGzdKEEm7boHdnDmV95TQRh3 GPqSETgeMkkAPewNx+5VbynQL2eJHd8qx1Rvi+I8yS0ou1kC3zLi1I3p/hLL8ESakjr0 yaL8/Ap5g5c9Nod6UFdQ9ZzDrbojXffnqKFYoUDGxGC9YWy8sbbUo7IDB4AKF1WZO0cK 1ns01y0/nL04FvXT5+QTs3UmIagsCK1kKF0T9Dhihgj65H5cQRXqF5msridk2KCGaa6E +6mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si1904304ejk.72.2021.09.22.01.07.35; Wed, 22 Sep 2021 01:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbhIVIFY (ORCPT + 99 others); Wed, 22 Sep 2021 04:05:24 -0400 Received: from outbound-smtp34.blacknight.com ([46.22.139.253]:40287 "EHLO outbound-smtp34.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233381AbhIVIFX (ORCPT ); Wed, 22 Sep 2021 04:05:23 -0400 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp34.blacknight.com (Postfix) with ESMTPS id 38893250B 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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