Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp254118pxb; Mon, 13 Sep 2021 18:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzu8FGALJqp1vIn35X77FRwpuzQ0InHMDNOh5A5BSrkKHOVOVNDK/7iyRAQvE1sWlnDmGL X-Received: by 2002:a05:6e02:2145:: with SMTP id d5mr10070536ilv.214.1631582934508; Mon, 13 Sep 2021 18:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631582934; cv=none; d=google.com; s=arc-20160816; b=nwK/O1aAHaS7Y2MSV390XsIX7azJ+VAzE/vOYW/uX0VWxRb8ZZ6twpLj7AO/r8ZBuh Htxsam7CW90z1t2ZxqkXCbVBncFvgM0COKwkX0SoKkGPGqBurae142/nGm/VF5OfdYVa 20xA418HNHHfaAwvqB6cvZlHTO22uG6CjdG4I4iOX2HVWV+bWbERj9WCws2ee0U7m7We zrCZGo33VPghXqmexuRQxYaLf6I9ZcyIriDOULHr+YEVNC+kMZ1UKnulb7e9GJ0qFi8D ef7639DPDHKHaQPd1Y7pJ/gOeBxJ78DEE8c91+wP+dT8YHUyRQ9Derojpf4JHHJbp+x+ poVQ== 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:cc:subject:date:to :from:dkim-signature:dkim-signature; bh=fz478wuK2aqSUdVMTm0N58JnzuLLXcDfeQcH+i0TRAc=; b=qMSozgcUKtddLn275o+tLQFadlGJIzrM6HEcZYGuIaD0BGvgRL6Un9cKp5xbpV8gFw B0JLG2W9/5ggWWI3HPtj7t14jA5fxuajqCP5aKow93aCVpcPXOfFxzwV2Mm3GmHvNnDC Qz8MHvwP0yhgI4D+elpYkWBeiyk1tIPKw5ct+dKBn0ezdulUP8mwRnuEQkcVljqHwths 5YrF0/tJV9c4bShKEhuWlHH95VOV+hIkoISiGzRsH96berxUaDJDCKcCMw63D2EV1iR6 zb4xiHQ70wjEt2FmazynI1pb3vfnhL/ZIoA939kBwWVDzIioFdMYYS/5HWSRdxEFqkO0 nxjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=xe9UJcFJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=Z5hLlNcu; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 189si9174246ioa.35.2021.09.13.18.28.43; Mon, 13 Sep 2021 18:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=xe9UJcFJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=Z5hLlNcu; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 S238340AbhINA3S (ORCPT + 99 others); Mon, 13 Sep 2021 20:29:18 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55074 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238305AbhINA3S (ORCPT ); Mon, 13 Sep 2021 20:29:18 -0400 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 94D4E200AA; Tue, 14 Sep 2021 00:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1631579280; 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=fz478wuK2aqSUdVMTm0N58JnzuLLXcDfeQcH+i0TRAc=; b=xe9UJcFJ9/etWuZVpkedbCfZdZGh4I+9k/xRiVFR+eOLjUc/38MzmSICzhxCaBDieHWCCU IGfVi+k1JTkaS1tbSmYAM2N1g3fFIk1xYp+Z9Ww/PkVOo0+PW5yrER7llpNQuvMk4su7zT Bx3yl4AFRjURJB8UHQZi0ijxP89K9dA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1631579280; 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=fz478wuK2aqSUdVMTm0N58JnzuLLXcDfeQcH+i0TRAc=; b=Z5hLlNcuwJJinzCF56fW+4/hhbShZz4exvm5VcH5q6dN4x9juqo28ZwRLP51q89RkWh1Kh Pld6ww2EgjdayQDQ== 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 386E713ADE; Tue, 14 Sep 2021 00:27:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5x0MOozsP2EiawAAMHmgww (envelope-from ); Tue, 14 Sep 2021 00:27:56 +0000 From: NeilBrown To: Andrew Morton , Theodore Ts'o , Andreas Dilger , "Darrick J. Wong" , Matthew Wilcox , Mel Gorman Date: Tue, 14 Sep 2021 10:13:04 +1000 Subject: [PATCH 2/6] MM: annotate congestion_wait() and wait_iff_congested() as ineffective. Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Message-ID: <163157838437.13293.15392955714346973750.stgit@noble.brown> In-Reply-To: <163157808321.13293.486682642188075090.stgit@noble.brown> References: <163157808321.13293.486682642188075090.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-ext4@vger.kernel.org Only 4 subsystems call set_bdi_congested() or clear_bdi_congested(): block/pktcdvd, fs/ceph fs/fuse fs/nfs It may make sense to use congestion_wait() or wait_iff_congested() within these subsystems, but they have no value outside of these. Add documentation comments to these functions to discourage further use. Signed-off-by: NeilBrown --- include/linux/backing-dev.h | 7 +++++++ mm/backing-dev.c | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index ac7f231b8825..cc9513840351 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -153,6 +153,13 @@ static inline int wb_congested(struct bdi_writeback *wb, int cong_bits) return wb->congested & cong_bits; } +/* NOTE congestion_wait() and wait_iff_congested() are + * largely useless except as documentation. + * congestion_wait() will (almost) always wait for the given timeout. + * wait_iff_congested() will (almost) never wait, but will call + * cond_resched(). + * Were possible an alternative waiting strategy should be found. + */ long congestion_wait(int sync, long timeout); long wait_iff_congested(int sync, long timeout); diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 4a9d4e27d0d9..53472ab38796 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -1023,6 +1023,11 @@ EXPORT_SYMBOL(set_bdi_congested); * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit * write congestion. If no backing_devs are congested then just wait for the * next write to be completed. + * + * NOTE: in the current implementation, hardly any backing_devs are ever + * marked as congested, and write-completion is rarely reported (see calls + * to clear_bdi_congested). So this should not be assumed to ever wake before + * the timeout. */ long congestion_wait(int sync, long timeout) { @@ -1054,6 +1059,10 @@ EXPORT_SYMBOL(congestion_wait); * The return value is 0 if the sleep is for the full timeout. Otherwise, * it is the number of jiffies that were still remaining when the function * returned. return_value == timeout implies the function did not sleep. + * + * NOTE: in the current implementation, hardly any backing_devs are ever + * marked as congested, and write-completion is rarely reported (see calls + * to clear_bdi_congested). So this should not be assumed to sleep at all. */ long wait_iff_congested(int sync, long timeout) {