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 4DDA2EB64D9 for ; Tue, 27 Jun 2023 14:48:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8C0C8D0002; Tue, 27 Jun 2023 10:48:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3BC38D0001; Tue, 27 Jun 2023 10:48:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2BB58D0002; Tue, 27 Jun 2023 10:48:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A47818D0001 for ; Tue, 27 Jun 2023 10:48:31 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 718681C86C6 for ; Tue, 27 Jun 2023 14:48:31 +0000 (UTC) X-FDA: 80948808822.10.72E8C80 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id C552B4000E for ; Tue, 27 Jun 2023 14:48:27 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PadBDPEn; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687877308; 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=2q4n1zKRqrV3v5scjVFFq+TN6vQz15i/WxunL9evbOk=; b=5IwRMU/SESntE4L3R5JLF32F8JHeque8TBeM5C6ZUcrQDBpI5bIf28tpYosXHroAb3s4Pi 87TcVJbs2MkSbg2qbvnS9UKv/0MEK2xzwvjPaWhY4ajlscq1i8dkr+NMQ8pMw/dLSHX8n5 8vPi3+kvg/Npxdn62lS6xiJGAKvOyrg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PadBDPEn; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687877308; a=rsa-sha256; cv=none; b=bs9upfzhqdSLkZGhKD1JItsqk7FkLCsl0kK/kBypOo2fa+xC04wkNcG7FzoESEvOzZ7ZET yIxFl6JBqjru1Fpy+Oo7IA3EnnWewdpudTRR/aPKHO0UySBgpI/Tt8nhpfvgHsAYYmVcAm 9sr8+sIq3Fnz7at4EEoirSB1j4Xyceg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2q4n1zKRqrV3v5scjVFFq+TN6vQz15i/WxunL9evbOk=; b=PadBDPEnw+r1U1a2NesSR9R0J3 4D4avMQnSzeeXMJTw4OZDlNRLAzlJoOTXBDCcYfMfgwnucu67fcOxbkZFax5h9PwM9a3oI3GEIw4n afRibzDA8+iYgWNTFxz5G9rROJXu4Acexu3PWFqA6XyZ4uMs8CYgWcmxlzch9cLoODVgX3GD9crJc D/b9QFOo77xyhUvjS68Fso+p5um4Dw3z05lScl7baFip/xNorcmYi67oqcV2tXXdJu7nf75qFy5fO gzpa+fFMOviRbwqTPE80Hm22Yo8vcBphziqcI6qLzanIu8lSi+Den6TujPfHnRibWe9W7aGMFa1hG DHt63sZQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qE9zS-002oS5-26; Tue, 27 Jun 2023 14:48:22 +0000 Date: Tue, 27 Jun 2023 15:48:22 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , David Howells Subject: Re: [PATCH 03/12] writeback: Factor should_writeback_folio() out of write_cache_pages() Message-ID: References: <20230626173521.459345-1-willy@infradead.org> <20230626173521.459345-4-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C552B4000E X-Rspam-User: X-Stat-Signature: 9rg1awwuxdrhip81n8mjwihden5a17to X-Rspamd-Server: rspam01 X-HE-Tag: 1687877307-238125 X-HE-Meta: U2FsdGVkX19ed+X/crxslb5vuUO0LTstRk6bFSNwrspwOjV6oMzxcxkZ+9rhsDzqhFp2Wl83YQ3lGCaJ17mtrRBtD4Bz7KrwvIejV8I0RrRKRwV82hYOi5sSIytM3Uq4960QeSGUfzUTudOGBigEh2lzum6vl/ZY9evI6D/FhRPVwdPnG96QYEaX6IHwjjUR5jPMcfwRmAgA7vqHfYZzgyy5mt/DDOuGb1YnxCqzVdPH5N7Lx+Eoj8wq80TWlzhXa/sXBejE55FEmwNQut/Uk+zar4qp2T5sgA/2LPKXsLcFY/cn37c2or/Tl6X9/Uy11656NYejP/ZCS1jpl0IOF8LicG8ZnIWN/j2TlR7yxwvH6abYOwhGq3cBiE1fmfZMrwf3WV6mRCLiO8OTNiZs7C8mPk9xHuoS9swGTs3n9cBmH5bY1/BG8pecsEpNzvWl/tQ66Ld/9Km8jGrdpFJ+p6CmnoMG3AeqcU1pCx+MZyLc36uQN5jTKSYOsfFx2/SiF3E/dEqiZSbdnScoT2uBQdOEnM2J9xmPBHyF+NKz6uf8Wb/erbhJNu4RSwQMDFYqp6Vv2pe+id5d5huwd9xwrvmvMXm93ayAmfWz5k9bknw/MYGxLXCwNCog+h06WmTjH0aCUUWQy3dF71ad83cqxOHyytFI044sNtVkcAXyaDW4Ue2UjFrOnOavPQtRgVBCZlCwNIzPKyyHidrrqnPTUeWq4FWC8UrKa+UXl3+WJ4OAlA94CTw1Mj7Tu1e7N8i1J2HlzSUiUlZWuNSMDnaNfmSOmDDM6V1fEQxvVdBebxAg1b7k9yWdOQyO1vF1DZDrLu4zynsM58DVDlDPo1H+Je0LoQXeKGkYwypCctnhfalzwK/8lD7OPx12Z8ZprSj2nTzU8mffnoyWAWyHEUoPFfU2j1OWbI68+CfWW5crBNBYZoU6NLhD/QhkvJcKz54qsNMS5Eoem+08NLI1sG9 1XKsCnl+ ahGy5vo28DxDqZewQobFTbiPHsruU7R7Fyau/nzBEFlG0hUYj7eGEzKKmAOTrwjfdgt3B2oUtU0ow3EfImh7xM/Q0EOwAhPT/pBrpuyAJvqLBETec10Ie+2ec6vN4W1Te5UyE4N1kBcM/LNPLbqMilDiHhHOwXWKhbFJRXUEaW+wptH9bNwRm8Y7SHw== 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 Tue, Jun 27, 2023 at 12:16:34PM +0100, Matthew Wilcox wrote: > This might be a good point to share that I'm considering (eventually) > not taking the folio lock here. > > My plan looks something like this (not fully baked): > > truncation (and similar) paths currently lock the folio, They would both > lock the folio _and_ claim that they were doing writeback on the folio. > > Filesystems would receive the folio from the writeback iterator with > the writeback flag already set. > > > This allows, eg, folio mapping/unmapping to take place completely > independent of writeback. That seems like a good thing; I can't see > why the two should be connected. Ah, i_size is a problem. With an extending write, i_size is updated while holding the folio lock. If we're writing back a partial folio, we zero the tail. That must not race with an extending write. So either we'd need to take both the folio lock & wb_lock when updating i_size, or we'd need to take both the lock and wb_lock when writing back the last page of a file.