Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2390845pxb; Fri, 8 Oct 2021 06:55:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTgdfN9tCiYbzn4aGeN84UbEOeHF0iLMVmXxGGpDBW4XDBPMnjsdNTWzYg5e1jIlVRUnx3 X-Received: by 2002:a17:902:7fcf:b0:13e:c994:ee67 with SMTP id t15-20020a1709027fcf00b0013ec994ee67mr9457687plb.12.1633701343107; Fri, 08 Oct 2021 06:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633701343; cv=none; d=google.com; s=arc-20160816; b=GCSvvcYNJaBV649HndJ7Htp3MnlfrWndMencx7n6oIA9uBfNuz0Kbx8frSBONFVTuL 8TQ9V80puI2o2+wD2bis7F4SPP/I530yguadeu57rXiOsQWHG9egsZOTT67Gptj17HMR FsvxeMvjeZQU4v222PJ5vhj2GugbHNOsYuIn0kcgHakJ2VPpcPDdVoO9ewpVR+wCmcx7 g/4PWIozHvIs/BB8CvKcR54gXUAk3V6ux8BehGKZK3uZNxBwen6EpGFWAdd/6QAyEzmM wPAurnyTe4xeTMeKwXikwSz15mhqP0JZcDk2FAQcYSxhxmmci0+PuK3MEtalRLWHCtq+ Rs6g== 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=G4oynEcAP58+jnY8zQkFNJRv6RXY8tDtGAoGMQ1cFBnpN3Q/rXWLuQuFdmooZ8c+4J RziLy0UW+VkMgoZMx0ul7BH5seoMxNwBmBuUAJJZUn54yAp1hBNPTm2CuDbz9Z9aAZRP naoyZss98EGLfRm0EfTUsiASimPL4Mz5JHi2hpWot6nSgLds21Xdo08lj+QtD9n3qUIt maVj5N//AwTT+9GV31XEVr9vmAB8e78uBjEv/gK7PucFiDJhsqP5qZSFEftUC++fBLix mF8LsUAoyXhF2UPRQxbKsCmAy6KSM4TB9zNbdl5mPGLtfsx/XCM+ulHvDpRne7GXDXDw i2Cg== 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 ca5si12073256pjb.1.2021.10.08.06.55.30; Fri, 08 Oct 2021 06:55:43 -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 S242093AbhJHN4V (ORCPT + 99 others); Fri, 8 Oct 2021 09:56:21 -0400 Received: from outbound-smtp35.blacknight.com ([46.22.139.218]:59077 "EHLO outbound-smtp35.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241313AbhJHN4U (ORCPT ); Fri, 8 Oct 2021 09:56:20 -0400 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp35.blacknight.com (Postfix) with ESMTPS id 0BBD71BD5 for ; Fri, 8 Oct 2021 14:54:24 +0100 (IST) Received: (qmail 6769 invoked from network); 8 Oct 2021 13:54:23 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.17.29]) by 81.17.254.9 with ESMTPA; 8 Oct 2021 13:54:23 -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/8] mm/writeback: Throttle based on page writeback instead of congestion Date: Fri, 8 Oct 2021 14:53:28 +0100 Message-Id: <20211008135332.19567-5-mgorman@techsingularity.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211008135332.19567-1-mgorman@techsingularity.net> References: <20211008135332.19567-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