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 987B5C433EF for ; Tue, 21 Sep 2021 10:58:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7193C61168 for ; Tue, 21 Sep 2021 10:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232218AbhIULAD (ORCPT ); Tue, 21 Sep 2021 07:00:03 -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