Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp252409pxb; Tue, 19 Oct 2021 02:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQIw48/jNWMtJ3kwTN8NkEOAiUN8iazccBIEG/5wvEbZhSotl1wqRfnGmf5h3e1OWanMfE X-Received: by 2002:a17:902:a385:b0:13e:99e9:17f3 with SMTP id x5-20020a170902a38500b0013e99e917f3mr32164480pla.65.1634634278863; Tue, 19 Oct 2021 02:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634634278; cv=none; d=google.com; s=arc-20160816; b=rWB2J+xwd2Jy3zj4RxB4AoECWjgbNq4Acpn9lnIUL0ursm4xdhoKYoS9U36QFBAAAt rUOyOOWvRsAnSDDKycrCWqMB8DCpWMwSyCqGI4U16sQBGW3iQUzYAbLLHUl7852MpviQ opFHkPs/eO91k8Wasa5ulaUXd44mzQnnZfkfiPgn7sPup4b+euyw2tvRbceDM6OnYOdb FArG1XlSCiu/YG2HaWSHog7cGrSbVj8W5DQgx7nyvTfGNMnBvyHu3wxpE6Grz7tmvkAC 77pdxLZ11pCpZU6GCGvYnK+BpQY8uGJEk8cBDOxyOhALmmLZ0t9vQU/KM2CIdTT48vUR euLg== 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=BC+scv4VRTcEfj0pZRoSHcpJwYG7xfZ1p+6TR0mxqqI=; b=rsqhmcha9L37L2Yg97/JxKFeGwR0hIMkMorvbycRft6A9R1twHj1BrcVm/yI2nljr8 5b7l7i18JFQznwgKSKLKW8MjNic/7A69B+F3PuWo4fClJeaKfNQZx/TAtBd8HW/80OGM AKyc2qpBk+y+Z+CkfNgfWPtz8/2VJQxNUKRZh7TRcj6bzE/PSInwpXwBzrAtBSMQXwyZ C1QSDLpXIP4UXXRwjMVJxjBX6GLOfZlSwh8g8+zg8YNVZQqN4QEnOfbA+oNhT4qga2qz VzeJTkaTtAFBs7A2vNNZ8QrQPjZ2L+42Qwh6WVLIcRDd3NfiQJszrFIixkdfxO1u5WBG J31A== 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 ob16si3473255pjb.120.2021.10.19.02.04.25; Tue, 19 Oct 2021 02:04:38 -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 S234561AbhJSJEP (ORCPT + 99 others); Tue, 19 Oct 2021 05:04:15 -0400 Received: from outbound-smtp61.blacknight.com ([46.22.136.249]:47933 "EHLO outbound-smtp61.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbhJSJEN (ORCPT ); Tue, 19 Oct 2021 05:04:13 -0400 Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp61.blacknight.com (Postfix) with ESMTPS id 06465FBF84 for ; Tue, 19 Oct 2021 10:02:00 +0100 (IST) Received: (qmail 7683 invoked from network); 19 Oct 2021 09:01:59 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPA; 19 Oct 2021 09:01:59 -0000 From: Mel Gorman To: Andrew Morton 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-MM , Linux-fsdevel , LKML , Mel Gorman Subject: [PATCH 4/8] mm/writeback: Throttle based on page writeback instead of congestion Date: Tue, 19 Oct 2021 10:01:04 +0100 Message-Id: <20211019090108.25501-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211019090108.25501-1-mgorman@techsingularity.net> References: <20211019090108.25501-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 Acked-by: Vlastimil Babka --- 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