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.2 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 C7D52C433EF for ; Tue, 21 Sep 2021 10:58:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6366760F3A for ; Tue, 21 Sep 2021 10:58:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6366760F3A 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 DB1E5940007; Tue, 21 Sep 2021 06:58:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D39FC900002; Tue, 21 Sep 2021 06:58:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C025B940007; Tue, 21 Sep 2021 06:58:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B17ED900002 for ; Tue, 21 Sep 2021 06:58:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5B27B8249980 for ; Tue, 21 Sep 2021 10:58:37 +0000 (UTC) X-FDA: 78611282274.01.8466053 Received: from outbound-smtp55.blacknight.com (outbound-smtp55.blacknight.com [46.22.136.239]) by imf09.hostedemail.com (Postfix) with ESMTP id 0C4983000111 for ; Tue, 21 Sep 2021 10:58:36 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id 5542FFAFCC for ; Tue, 21 Sep 2021 11:58:33 +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) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.239 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0C4983000111 X-Stat-Signature: i3ousrcfmoekptftg5mdt3pqcnqu5dfi X-HE-Tag: 1632221916-332247 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 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