Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10156954pxu; Tue, 29 Dec 2020 16:00:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJww/oZIqZufBJFZikNomq/KvYiyKpo91dc8dfR03ekVfP95wfPeP5CafbfYa1bInrFXSTVb X-Received: by 2002:a17:906:ce23:: with SMTP id sd3mr47592882ejb.69.1609286415240; Tue, 29 Dec 2020 16:00:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609286415; cv=none; d=google.com; s=arc-20160816; b=DAJC9BT/cfp7ijGAC5nmdwA9fRs8TC4iM5EItQxTeReTrkQGtLc9JRtnxiCdYFAiRp EjnfxvrwKUOBjI18RX8qSGehH8pHD0xd4Rpm7SL13FK6SG+mvM9zqNiYewmn8g0zx45t P4DhcYYYZRKdFle6aWnGqeUOp7P4KXhID9MiQZXwmaIjU5MCCvynYvabEuzgVZmo8zA6 CzKOY5KzwUAIKHQQ74X0wsskWeYE9TCktjESt7mSRmYzu6KjlISbGOwQEZ7wmHN54ofP wTx+YmMNahLqh+Yoi25lkHkgpe7WYh4Dl8vJNNoa6XrU2GoBn46ci+kGFn5krXcN2dqT EChg== 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=Z9F4KIRWnZFjScyol16z7tpxzXTX3Y8qgAbGn/GfAD8=; b=wDUdUsO2Gi7PMgdfdG62JyU3m3vkz5RbBbAdWu/qmtbwbjjqPz39XnoVPc6+jYLGV6 ocNT2+tqytOcPm7P1gJa22YBXm5YC6cxW7hMLlrbdnL5X5qTlJGJ7p3K3pgtplkGcppU eg0dgK0U1PNOMrGG70BfmbP/s/Yp9Nwxr+oMtFgyQ/MeQT4Qh38fiQjcK5/mR0VZpMaX b1ugTc5eoASea5DnQTDkMOEHZTDdgDqdqpFILMBrdQDEf00tSGdwEKioynniUv4F+Pc6 qN8GtaBMebYFjUsqJrDKGMySqJl1zIgqrr3HxRxBr2RsqIy9MCehMhMgXFVogxNCceSb KK9Q== 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 dh5si21800286edb.122.2020.12.29.15.59.50; Tue, 29 Dec 2020 16:00:15 -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; 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 S1726336AbgL2X5c (ORCPT + 99 others); Tue, 29 Dec 2020 18:57:32 -0500 Received: from mx3.molgen.mpg.de ([141.14.17.11]:55319 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726168AbgL2X5c (ORCPT ); Tue, 29 Dec 2020 18:57:32 -0500 Received: from deadbird.molgen.mpg.de (deadbird.molgen.mpg.de [141.14.19.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.molgen.mpg.de (Postfix) with ESMTPS id 17D8320646231; Wed, 30 Dec 2020 00:56:49 +0100 (CET) From: Donald Buczek To: linux-xfs@vger.kernel.org, Brian Foster , Dave Chinner Cc: Linux Kernel Mailing List , it+linux-xfs@molgen.mpg.de, Donald Buczek Subject: [PATCH] xfs: Wake CIL push waiters more reliably Date: Wed, 30 Dec 2020 00:56:27 +0100 Message-Id: <20201229235627.33289-1-buczek@molgen.mpg.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <1705b481-16db-391e-48a8-a932d1f137e7@molgen.mpg.de> References: <1705b481-16db-391e-48a8-a932d1f137e7@molgen.mpg.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Threads, which committed items to the CIL, wait in the xc_push_wait waitqueue when used_space in the push context goes over a limit. These threads need to be woken when the CIL is pushed. The CIL push worker tries to avoid the overhead of calling wake_all() when there are no waiters waiting. It does so by checking the same condition which caused the waits to happen. This, however, is unreliable, because ctx->space_used can actually decrease when items are recommitted. If the value goes below the limit while some threads are already waiting but before the push worker gets to it, these threads are not woken. Always wake all CIL push waiters. Test with waitqueue_active() as an optimization. This is possible, because we hold the xc_push_lock spinlock, which prevents additions to the waitqueue. Signed-off-by: Donald Buczek --- fs/xfs/xfs_log_cil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index b0ef071b3cb5..d620de8e217c 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c @@ -670,7 +670,7 @@ xlog_cil_push_work( /* * Wake up any background push waiters now this context is being pushed. */ - if (ctx->space_used >= XLOG_CIL_BLOCKING_SPACE_LIMIT(log)) + if (waitqueue_active(&cil->xc_push_wait)) wake_up_all(&cil->xc_push_wait); /* -- 2.26.2