Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2614023pxb; Tue, 21 Sep 2021 04:00:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhb6kYFd1xpWIDPftHkphh0AUAJdHNIVh8CtgBLH31FxEEiC9VWXUw1tvtiwArmB68luUA X-Received: by 2002:a17:906:781:: with SMTP id l1mr34593127ejc.289.1632222039755; Tue, 21 Sep 2021 04:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632222039; cv=none; d=google.com; s=arc-20160816; b=i0E8MFGufQTKw535mTbAqkP4zw0UZCc+CJ4zo2TGJvyQauFgSMDShDCLoAxcYkfhn6 zjfmSxDuGvx43/Gc9wPgdTLSbPtEBU1Gbc1pYMdzL2WrQQjRL/NGh2kbElF5GiXZhQBS atc2QiFTogRqIkMq/kwA4X3tj3IPpma7H9dkxzv2Kkfw9sG1vZ5piNXM3Q3/7BKqOAMY qIwTuCG0WD+PZQaN5iTfwF9K/HsvmaeIci8bqZ+7+cMwo5TYUENiu5cibLzdmAh26amS 3VDWCriRXpA8P6Bk2krDz6KSVhjevuhjJbgZPWbV0UPxaAO+RAeFEgp1aNAArft5AqoT 712w== 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=d7M1xYZwx9TvFSX0LEyvN2BtL/hGUn64sCfxU4eyClc=; b=EqD+KJLlqHb01YokVqsVFwYPibwL8bJqDXrUR8tm24fqU6NZKRZcLdXT+Yjh1p3ITh hNyzRf1J/YFu/tz+FuPdACNRafWbvw5uOUitxExogS6Dya6p5g7GO5ZeTEDnim0dVUzR KDfg8+tAY3HQ03ijKhDJtBa5pfZkNAMx6IEPO4DwiaG+ftCgZy5B1bXHzva7fdio+ECr 1lkJJ2Mi6F1FSgUpM4kNpN5m87+o4pzE4Bg9+F55oXCGYBwQinFCKDE4XL2P844pVV7X /NlHrjmf7FRiFEyLgH34Pxp3EvUMwXb7fiWK96Jb9xWE4BxN3RDwQ3Sf2NgUHGgQGaZX UZWQ== 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 i16si12129361ejd.241.2021.09.21.04.00.14; Tue, 21 Sep 2021 04:00:39 -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 S232174AbhIULAC (ORCPT + 99 others); Tue, 21 Sep 2021 07:00:02 -0400 Received: from outbound-smtp25.blacknight.com ([81.17.249.193]:53545 "EHLO outbound-smtp25.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbhIULAC (ORCPT ); Tue, 21 Sep 2021 07:00:02 -0400 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id DACE5CB1B9 for ; Tue, 21 Sep 2021 11:58:32 +0100 (IST) Received: (qmail 2738 invoked from network); 21 Sep 2021 10:58:32 -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); 21 Sep 2021 10:58:32 -0000 Date: Tue, 21 Sep 2021 11:58:31 +0100 From: Mel Gorman To: NeilBrown Cc: Linux-MM , Theodore Ts'o , Andreas Dilger , "Darrick J . Wong" , Matthew Wilcox , Michal Hocko , Dave Chinner , 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: <20210921105831.GO3959@techsingularity.net> References: <20210920085436.20939-1-mgorman@techsingularity.net> <20210920085436.20939-2-mgorman@techsingularity.net> <163218319798.3992.1165186037496786892@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <163218319798.3992.1165186037496786892@noble.neil.brown.name> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The original TASK_UNINTERRUPTIBLE is almost certainly a copy&paste from congestion_wait which may be called because a filesystem operation must complete before it can return to userspace so a signal waking it up is pointless. -- Mel Gorman SUSE Labs