Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp631820pxb; Tue, 1 Feb 2022 07:20:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPEjZeoVOmjBo8ZsSfJVq9p/iKhdqczr8Y/fHi+aqsLrkzpD4mDjrX4NmL3npzgUqsEdj1 X-Received: by 2002:a17:907:6089:: with SMTP id ht9mr20949881ejc.612.1643728848624; Tue, 01 Feb 2022 07:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728848; cv=none; d=google.com; s=arc-20160816; b=rzq5jkPdTjmXP3eXb08iIHm2RHw1iGn63aT1IQoUEPEuYS6DbKh2ohfU8Fv43amCpx mbCQ/HDDaMYpKGqX+8MrvcLKkmVAtfWnE/5NOZVCsectdcRsVARY/rCg5G76hsxDk6W7 C5ia6Iy76PkQY9awi6w9bTgh1DA429fA3tLK+IzUBmNnnj9O8Hi5LbBK/ySiHA0Ezoh+ yqbtcc5kBQ4+l+s40raAayA7JIWoxbMOwtL435J2XYUxZ91zXYPZ1aRYn61PhRH5X2Af QTEJAPUj5vuIIcdo0l8qjZgc4JhoACVBA703kd69yc4pYxFP4EDjicU3BFnms34YueRW K9yA== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:dkim-signature; bh=TvEfPPeht+6m2tsZLWgUEFf5HAsVvo5FwysookxUClM=; b=iB6ttxd7UWIdy0+vnT9IEnE74UFJNPZUcEAbCNl+j2z7q3l2w3Q/TF54aZeVNASzte u6KYeCiquXI6TYGbt6fixVVb+u24QaxF3l70OVslsV/glQjGzuHrwG8QM3xLGuF8j8Pe CnMwAW5OL9joH9fltAiTYi5I3+Y6mq0flX8Y/+YnhWra6pyyAOCzNlMHFd5So4rKJM+M lYUBYik3Wzqlky1ZJ1RUfaLwW0ztzKI1eg+1wEhxe3aUu3TlAsJ/0F18fEKw02kP7Dfp cU0nS9If5w6jo/4yBP8VcNs3XwHaJx5fJm/h5LLlFgpZbp3DQoeseFyjg5qBAxWG5avU gxJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pWLJsZQN; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sg35si5518220ejc.307.2022.02.01.07.20.23; Tue, 01 Feb 2022 07:20:48 -0800 (PST) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pWLJsZQN; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357563AbiAaEEY (ORCPT + 99 others); Sun, 30 Jan 2022 23:04:24 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:38114 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357535AbiAaEEV (ORCPT ); Sun, 30 Jan 2022 23:04:21 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E18DD1F37B; Mon, 31 Jan 2022 04:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643601859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TvEfPPeht+6m2tsZLWgUEFf5HAsVvo5FwysookxUClM=; b=pWLJsZQNiOZbmu3eHyMn/kzxEXxEDEFjwUaAFNCgalKi2l2pg/Kyz1XB4Ug4fvmkcYL69j MZqqyni/ZnMvg3P9IUpG5zl6SYCa8+Pm4oyJppurBjd8a0Ssqu1z0Kcg5i3XbqQbZOu7Wh rITudZlWMGA2T0ZLrgSx5ys/XVr3KfY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643601859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TvEfPPeht+6m2tsZLWgUEFf5HAsVvo5FwysookxUClM=; b=u+H/QuonS17YLO3VoRbzj2f8Ql1DJ8PA4qG9qwIyYO3JFIvSJsBoYhRdZUsgK2hLzNwIDz iTGQ7ht98k8zONDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BFA8A133A4; Mon, 31 Jan 2022 04:04:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id spA/H8Bf92GcCQAAMHmgww (envelope-from ); Mon, 31 Jan 2022 04:04:16 +0000 Subject: [PATCH 2/3] nfs: remove reliance on bdi congestion From: NeilBrown To: Andrew Morton , Jeff Layton , Ilya Dryomov , Miklos Szeredi , Trond Myklebust , Anna Schumaker Cc: linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:03:53 +1100 Message-ID: <164360183350.4233.691070075155620959.stgit@noble.brown> In-Reply-To: <164360127045.4233.2606812444285122570.stgit@noble.brown> References: <164360127045.4233.2606812444285122570.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bdi congestion tracking in not widely used and will be removed. NFS is one of a small number of filesystems that uses it, setting just the async (write) congestion flag at what it determines are appropriate times. The only remaining effect of the async flag is to cause (some) WB_SYNC_NONE writes to be skipped. So instead of setting the flag, set an internal flag and change: - .writepages to do nothing if WB_SYNC_NONE and the flag is set - .writepage to return AOP_WRITEPAGE_ACTIVATE if WB_SYNC_NONE and the flag is set. The writepages change causes a behavioural change in that pageout() can now return PAGE_ACTIVATE instead of PAGE_KEEP, so SetPageActive() will be called on the page which (I think) wil further delay the next attempt at writeout. This might be a good thing. Signed-off-by: NeilBrown --- fs/nfs/write.c | 12 ++++++++++-- include/linux/nfs_fs_sb.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 987a187bd39a..b7c6721dd36d 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -417,7 +417,7 @@ static void nfs_set_page_writeback(struct page *page) if (atomic_long_inc_return(&nfss->writeback) > NFS_CONGESTION_ON_THRESH) - set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC); + nfss->write_congested = 1; } static void nfs_end_page_writeback(struct nfs_page *req) @@ -433,7 +433,7 @@ static void nfs_end_page_writeback(struct nfs_page *req) end_page_writeback(req->wb_page); if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) - clear_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC); + nfss->write_congested = 0; } /* @@ -672,6 +672,10 @@ static int nfs_writepage_locked(struct page *page, struct inode *inode = page_file_mapping(page)->host; int err; + if (wbc->sync_mode == WB_SYNC_NONE && + NFS_SERVER(inode)->write_congested) + return AOP_WRITEPAGE_ACTIVATE; + nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); nfs_pageio_init_write(&pgio, inode, 0, false, &nfs_async_write_completion_ops); @@ -719,6 +723,10 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) int priority = 0; int err; + if (wbc->sync_mode == WB_SYNC_NONE && + NFS_SERVER(inode)->write_congested) + return 0; + nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES); if (!(mntflags & NFS_MOUNT_WRITE_EAGER) || wbc->for_kupdate || diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index ca0959e51e81..6aa2a200676a 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -138,6 +138,7 @@ struct nfs_server { struct nlm_host *nlm_host; /* NLM client handle */ struct nfs_iostats __percpu *io_stats; /* I/O statistics */ atomic_long_t writeback; /* number of writeback pages */ + unsigned int write_congested;/* flag set when writeback gets too high */ unsigned int flags; /* various flags */ /* The following are for internal use only. Also see uapi/linux/nfs_mount.h */