Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp466192pxb; Wed, 29 Sep 2021 03:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVr2qBZIY/jZ2ZPTHlnxjw77GAI64uCKv1VtH18rD+l0/QvnOIub7IMYa3viFaquA8MFW2 X-Received: by 2002:a17:906:cce9:: with SMTP id ot41mr8558509ejb.263.1632910381095; Wed, 29 Sep 2021 03:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632910381; cv=none; d=google.com; s=arc-20160816; b=Xl4KCoCocIOkTlUfA7z/JkDZqE/ysP0/BtT8uFk9AZDA+uSPagXoWa9UldFALEPTfm Lfwu2V89IU59w6KVJuKC/Z17K1Mci2KU8t7k6sCLG6bMrYvUlF5nJzsgfPqP+ZtzNPhY 9Q0Y1B4rulrBFdeHhzPC72H07PARPWa7y0A8PSStyaQhqNUu7z/KhVCHsP9XLO8EY6jV 3ntNmhL7K+YldhAiNVUmbkb0PdE9TZbAJduZj13HDihccoQOqysr+Q7w57zP9X24plyE HGYnl/HXbsAJ/JtkKLnU3Nld1h+VHOUfqNhqt0t8Cdo1JENHOmvwJ+Rf5eUTN+kxqejh XRpQ== 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=uKNlaJ8vmn/n8S5tyaXKBrq3wDZkwMn2o4V2DVZVXJ8dGLlBYR2o4OxVvVhQZ7bCj8 t6ToYZjfLFpIEiM/BLov0Wdac3ks6kFtXALCqxHZ+4aB6DcBqkwq/CtGUbJ0TqRXL+4M +KzlimJ7Sl2q8UoVe1cjRcC26ueoGsBDpDIPISnNUqxXKkWphw5h7p19qocpG6xi8/ay 7BXNl7ryZYuIUV3nnZFFRHuFAYGDJy4wBKGyF3cI8zmmHDagDgFA4tVi0FkSkK8evUBQ 3uRbyIizN8U8F/7HJUXPVfvh7qO5joiAXeXuwwAFRIxNLsO+CCLWO49iPw+E+/sczgGh FlmQ== 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 hz13si2162730ejc.2.2021.09.29.03.12.20; Wed, 29 Sep 2021 03:13:01 -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 S245357AbhI2KLv (ORCPT + 99 others); Wed, 29 Sep 2021 06:11:51 -0400 Received: from outbound-smtp09.blacknight.com ([46.22.139.14]:49813 "EHLO outbound-smtp09.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245353AbhI2KLu (ORCPT ); Wed, 29 Sep 2021 06:11:50 -0400 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp09.blacknight.com (Postfix) with ESMTPS id ABEA51C3C12 for ; Wed, 29 Sep 2021 11:10:08 +0100 (IST) Received: (qmail 20883 invoked from network); 29 Sep 2021 10:10:08 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPA; 29 Sep 2021 10:10:07 -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: Wed, 29 Sep 2021 11:09:13 +0100 Message-Id: <20210929100914.14704-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929100914.14704-1-mgorman@techsingularity.net> References: <20210929100914.14704-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