Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1689697pxb; Mon, 20 Sep 2021 03:00:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOZ211H80CWOoCSGPadsaGjCzndlBLtIB6jExKPCtBP8NueWkUsvdTa1d4hTAQ402ZJX9G X-Received: by 2002:a17:906:7b54:: with SMTP id n20mr27590638ejo.525.1632132002438; Mon, 20 Sep 2021 03:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632132002; cv=none; d=google.com; s=arc-20160816; b=VIj0WZEXw5MA37EQ2sU7HMbLG6xlJMs4Im7YDJ5XLbF61wZ5c0a0XubQ4OOhoHDWcv wJbPnAb/YmcM8L3bu1BDWdW/Pa0aj/v8PUzVfcP3/b9IbKoQaj305l/cw/lGI/1CJFn6 dYkvAKf1XqekMJZI/FM6ceNmkEQAQpfhA10c4zYgiWUVYW/L9wWVwIgHZfZe1dvXqO44 YS9EVMliHm0aE+rypsXuD5XqvlyMPC/+fg1RXj0I91acKrZ7AqVtzgLWzzl/lj67+haW EVzC7wh07TG6HXeNNh9+j/lvtycu3PznsDf9A36NlXsbdoxaNO930W/8xRYRyMg9fmWn xKbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k/BCTRu229dNEPvU4egnW6oeF+Cm4Z+ypZQ4H9tE/cE=; b=KNjHaWcL53+JJA+uZRExPCCr1BVv0JoI0ACxtoNSMvviTEfHY/1ZSbmdI8NQtlDdw+ J3dv2eGC6ezwxgZYTUzRdOfrn3bCYRMG3j+1R6OVwOh65JogoFHB//S1Ewrdi75JiCwI FuCz7cDxiwOo37RhiQ7dAUWwEvcjg7KeUFCInGrU6lKR6B/0vM7fNPX3NtprQdAsp9P4 cEl4bVnGygkhFYkRDGGK2iRzx2IMDCab4oIp0HX/iqXnq7DyF2vhoS9vneCtzCWbt6iW e9Xq3mygR7eP91/zK4x1yLuGPwf4pBYaKQKW4ysB/gpFQzptoEaX9M1mWBHLEv2IQmFz QdJA== 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 h18si15379931ejt.663.2021.09.20.02.59.39; Mon, 20 Sep 2021 03:00:02 -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 S229844AbhITI5C (ORCPT + 99 others); Mon, 20 Sep 2021 04:57:02 -0400 Received: from outbound-smtp46.blacknight.com ([46.22.136.58]:52709 "EHLO outbound-smtp46.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236112AbhITI5A (ORCPT ); Mon, 20 Sep 2021 04:57:00 -0400 Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp46.blacknight.com (Postfix) with ESMTPS id 088F8FBD7B for ; Mon, 20 Sep 2021 09:55:31 +0100 (IST) Received: (qmail 28790 invoked from network); 20 Sep 2021 08:55:30 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPA; 20 Sep 2021 08:55:30 -0000 From: Mel Gorman To: Linux-MM Cc: NeilBrown , 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 , Mel Gorman Subject: [PATCH 4/5] mm/writeback: Throttle based on page writeback instead of congestion Date: Mon, 20 Sep 2021 09:54:35 +0100 Message-Id: <20210920085436.20939-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210920085436.20939-1-mgorman@techsingularity.net> References: <20210920085436.20939-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org do_writepages throttles on congestion if the writepages() fails due to a lack of memory but congestion_wait() is partially broken as the congestion state is not updated for all BDIs. This patch stalls waiting for a number of pages to complete writeback that located on the local node. The main weakness is that there is no correlation between the location of the inode's pages and locality but that is still better than congestion_wait. Signed-off-by: Mel Gorman --- mm/page-writeback.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 4812a17b288c..f34f54fcd5b4 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2366,8 +2366,15 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) ret = generic_writepages(mapping, wbc); if ((ret != -ENOMEM) || (wbc->sync_mode != WB_SYNC_ALL)) break; - cond_resched(); - congestion_wait(BLK_RW_ASYNC, HZ/50); + + /* + * Lacking an allocation context or the locality or writeback + * state of any of the inode's pages, throttle based on + * writeback activity on the local node. It's as good a + * guess as any. + */ + reclaim_throttle(NODE_DATA(numa_node_id()), + VMSCAN_THROTTLE_WRITEBACK, HZ/50); } /* * Usually few pages are written by now from those we've just submitted -- 2.31.1