From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB2E3C636CD for ; Fri, 10 Feb 2023 10:54:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DF46280006; Fri, 10 Feb 2023 05:54:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 08F84280003; Fri, 10 Feb 2023 05:54:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E99BB280006; Fri, 10 Feb 2023 05:54:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DA3C4280003 for ; Fri, 10 Feb 2023 05:54:18 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A6801814FA for ; Fri, 10 Feb 2023 10:54:18 +0000 (UTC) X-FDA: 80451072996.27.96DCAC0 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf21.hostedemail.com (Postfix) with ESMTP id 4E0751C0002 for ; Fri, 10 Feb 2023 10:54:16 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Zqabz1Ha; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="Z6lP7/fq"; spf=pass (imf21.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676026456; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Qd6hI//mXrSje7KDJTNwEI85+thpTgK/G3BL+ZFCWbs=; b=uGZge1ejL73jKDNwaZmZS/XO84x11yqOhu0pSTgbVmPhSnvzMJQYJ3SKdAoQhjeKNALbPx 8z/pmYxMFI9HhKu3Hvn5nudwTH/5/uYXD8Zmie/3YHj2M8oYixbgtMQFi1seznsGUoHqIz qKGcaevbbFVCz1JBaqUgZljNUPnRS/k= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Zqabz1Ha; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="Z6lP7/fq"; spf=pass (imf21.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676026456; a=rsa-sha256; cv=none; b=W28B55tkdWtgaM851lqy7ozVtsdyYhBZ6vZlahXWNtyLQcuADw8PvQ1xGaZir1aXJNTTRt T8j7dSjLhGNgL9w9iUNroYE1w6f/8CaHP9Os5N+r5/lA3p+GmM5LFR+xwDj0EZZ9ix3aR6 MN3lXWGNRiqvDwJifzUZWdgxoIwqZ/U= 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 03F6967420; Fri, 10 Feb 2023 10:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1676026455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Qd6hI//mXrSje7KDJTNwEI85+thpTgK/G3BL+ZFCWbs=; b=Zqabz1HaHQVUoOIoseWWANEs+FKK/VZy9pUuPg2oUsL0sv8/3d1eb6I4Lf9ro8NzMc1WFq 0l94AmTWWi3vD+XSZNQALO4YuSaVCZk4GUpk5PA3+PPFkzFpnAaZARgcnPcZgX98m2/Fbl gazc+VmS2NAFXgNtj2Uir9vyYz3ex7o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1676026455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Qd6hI//mXrSje7KDJTNwEI85+thpTgK/G3BL+ZFCWbs=; b=Z6lP7/fqHBmxR1Pci8Tz+uMVl1pQCRUOn2xngg/7G1sN+nHVslHxmtA9NwCRuxEQ+n/e4D f5QQ17inYS2EQWBg== 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 E921C1325E; Fri, 10 Feb 2023 10:54:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id r6XgOFYi5mPqVwAAMHmgww (envelope-from ); Fri, 10 Feb 2023 10:54:14 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 60349A06D8; Fri, 10 Feb 2023 11:54:12 +0100 (CET) Date: Fri, 10 Feb 2023 11:54:12 +0100 From: Jan Kara To: John Hubbard Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, David Howells , David Hildenbrand Subject: Re: [PATCH 3/5] mm: Do not try to write pinned folio during memory cleaning writeback Message-ID: <20230210105412.7xobajl2p7ulhclr@quack3> References: <20230209121046.25360-1-jack@suse.cz> <20230209123206.3548-3-jack@suse.cz> <4961eb2d-c36b-d6a5-6a43-0c35d24606c0@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4961eb2d-c36b-d6a5-6a43-0c35d24606c0@nvidia.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4E0751C0002 X-Stat-Signature: 1humn64q1cs9egkzcksn1tkusmojdcb3 X-Rspam-User: X-HE-Tag: 1676026456-157310 X-HE-Meta: U2FsdGVkX19svGlGGzDkT3uORf0XjVv+n2on+GOv7fihajQY+HIYGWcMwvbmI/K/sqLx703yKFGoRSZ5TSek7mGHcFuU0kyqfuBAHCpaVDLv6grt6NnCrMN+RTyOiqqbOmlpSuL7f9y0rHybRF3R7XQ4umKkGWTWEmihSPMTC0ODvODtNaMeljNIHKjL7ju1fjZ4GjxOVKy1WjucH/9OiQ+pDjp/kDz6X4DiXe1Um24aD7zlzGbJBNiqcHMwE3eJwH6WrxaUQ9VnFbepPLQ2/JP4bMZRtncGyxxsWz7WZU92GbMRgJ06iYUcNaMcj8SI7oXgT98pmpUbb3UlFmAuERjkTTYIlHb+dLGwxyHtpNyF0kjy5F4lFzxG9fCk95lkUsOPcfMsfbVU88gaebYvoSDs6HZVIVNQ4O+M0K/5M5TwuW0fYshIXR8tJWcv5+t8+T94LUvqoHUXjaC/vCpmv6fQRGttTgCIi46Gj5ZXASDnSXJFgFq8q+0Uo75IFD6du4zgSODJtHpaeF9s42n9qA50dUP3dZFmFZegDcaZeN0W2XTH211LI/gmAiLDKapujnrPcHoxatrSrBdhRuXlL12lJq5WBhPxGA+TBe7kXruSAGIyw54c2eLpi46EajsS5m/Z6FriqramW868RGjnWjmDFxEsmNbosy4E9NJttaR39UYPdsPzfWqnCnNelF0KqBOwe/r72hkEhrUmLdsv1rZBkT/VrDx2rFxBtFdMoOYMo5a84DhiVAqd7QEHwzVlybd/6p5NF+7sZsod7pmr4kvbQdj53K/5gSijnd7lO+/qRr9WFfcaxC71koCJHi3aPHbPH/mXKq0LtL9d/UoQyJYbCJwgPx/FMyC8dadqfcsOLNFnAZlNjoGnaIlwJlM8adjxGc/YzYTaanTiCH/+e+/NMsdLA0fUwRWYzZ6NlcN65IaG05PZ6eHnjtkjcdjpvCjNZG5GF+TnySZiqWB W5DDQb1c cVcuZBpryBsiu8VmxTAn7C1p9GuJaJ4ETQKEEZEzmbGKc7J/lXGcHXV4Cm+HMErEfgwBJlT8YRPI9rijlxSSpMsZ2pRVS2ueEb0ISg+k1IHFzYUx5wYKUwa7+C8GCENrychCivZznjzi5h5+twir3NRqtAln+Kjz/mGcMSGucsiCC3NTLX99ADL0dOgqtKf65XudQfKLppMKKc5rF2pCCSA9T9GIJ01MC65nyoXptYtZEdnYs4Wk68AdrQDzB3bbVue5QF0n6M10jiZg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 09-02-23 17:54:14, John Hubbard wrote: > On 2/9/23 04:31, Jan Kara wrote: > > When a folio is pinned, there is no point in trying to write it during > > memory cleaning writeback. We cannot reclaim the folio until it is > > unpinned anyway and we cannot even be sure the folio is really clean. > > On top of that writeback of such folio may be problematic as the data > > can change while the writeback is running thus causing checksum or > > DIF/DIX failures. So just don't bother doing memory cleaning writeback > > for pinned folios. > > > > Signed-off-by: Jan Kara > > --- > > fs/9p/vfs_addr.c | 2 +- > > fs/afs/file.c | 2 +- > > fs/afs/write.c | 6 +++--- > > fs/btrfs/extent_io.c | 14 +++++++------- > > fs/btrfs/free-space-cache.c | 2 +- > > fs/btrfs/inode.c | 2 +- > > fs/btrfs/subpage.c | 2 +- > > Hi Jan! > > Just a quick note that this breaks the btrfs build in subpage.c. > Because, unfortunately, btrfs creates 6 sets of functions via calls to a > macro: IMPLEMENT_BTRFS_PAGE_OPS(). And that expects only one argument to > the clear_page_func, and thus to clear_page_dirty_for_io(). > > It seems infeasible (right?) to add another argument to the other > clear_page_func functions, which include: > > ClearPageUptodate > ClearPageError > end_page_writeback > ClearPageOrdered > ClearPageChecked > > , so I expect IMPLEMENT_BTRFS_PAGE_OPS() may need to be partially > unrolled, in order to pass in the new writeback control arg to > clear_page_dirty_for_io(). Aha, thanks for catching this. So it is easy to fix this to make things compile (just a wrapper around clear_page_dirty_for_io() - done now). It will be a bit more challenging to propagate wbc into there for proper decision - that will probably need these functions not to be defined by the macros. Honza -- Jan Kara SUSE Labs, CR