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 90075C47DAF for ; Thu, 18 Jan 2024 14:09:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24B416B0081; Thu, 18 Jan 2024 09:09:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FB866B0085; Thu, 18 Jan 2024 09:09:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C36D6B0088; Thu, 18 Jan 2024 09:09:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EC1076B0081 for ; Thu, 18 Jan 2024 09:09:55 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 87D12C0CC3 for ; Thu, 18 Jan 2024 14:09:55 +0000 (UTC) X-FDA: 81692615550.30.906A911 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf13.hostedemail.com (Postfix) with ESMTP id 40FE620025 for ; Thu, 18 Jan 2024 14:09:52 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="DSLfcV/8"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705586994; 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=eDyJsTpMEFjWM8ybsdyjwVweNQ+VIBpHno2AE+tAOXw=; b=1NUIdVwRyjePexi4TvCSabFIm4XUqjWPFclVA1Um7RR/WUK6pepPcCQQZSOC6yPhfcp0Y8 tFxE8sRWBbWQzFdwqAtUp7GTu23XeuNL0B+JfVsmq76eOGMNkZjXSvWbo3esjfrSr0mRGM GnR6NSOLZ7li/Ojh51BXeSmWvtDPN5M= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="DSLfcV/8"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705586994; a=rsa-sha256; cv=none; b=SVXkSjiTYt3g4a5jThTvRhCMk1SF4upYlAO8GiXpCPVQ5jig1om8xm055lcVOh4sPBJIbW NwxFIW8P0SVv1rtnuc1YYnBhMGMuwvodaW4CSLbBcl3fyKUWL1qEnmL0FACwmX8WozwWel SvzS0t2Zg/8mZG0MBcgpdugsXvc0CNI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A2215CE1F6B; Thu, 18 Jan 2024 14:09:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C05BC433C7; Thu, 18 Jan 2024 14:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705586988; bh=+uFBRg+XaeNY1sPVwHQo/VqbyI65U/bod8Ks5LIqYek=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DSLfcV/8yBbm5ZKTFUL/doJcqcL30ntPGL5eUWW/TeQoN3+eR18xeiODZBxQm/phq MvI2qyplIJVT4lioZi9Qsn3Bxa875gxGHedOjrayo+doO0D6kpFHloWjxREaTxRJm0 bvHwOiooFm9wMJEHLlClXMob6KwfpLcexr47QGf1QIaZ4d8u/N7FhnQZ7BBeoBiUBF 74ub4EOUPfPj3gveMAblHaarh2jWcCqV4rUTTJ4YJsNr+nVt7ylmBofxtmCshPONyE sb5r5cvstJGRU/wa6pT770I+bpWtWZbHaZFEuKx+tVbj7BVsMZAKVCUx2Sb9AlWo41 lYc8CNKddhXfQ== Date: Thu, 18 Jan 2024 15:09:42 +0100 From: Christian Brauner To: Dave Chinner Cc: lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-block@vger.kernel.org, Matthew Wilcox , Jan Kara , Christoph Hellwig , adrianvovk@gmail.com Subject: Re: [LSF/MM/BPF TOPIC] Dropping page cache of individual fs Message-ID: <20240118-wieweit-windschatten-19cfa8111b45@brauner> References: <20240116-tagelang-zugnummer-349edd1b5792@brauner> <20240117-yuppie-unflexibel-dbbb281cb948@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Stat-Signature: j4qfe9k5m6xbmu7cfkbpwyd1aatcpnza X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 40FE620025 X-HE-Tag: 1705586992-963414 X-HE-Meta: U2FsdGVkX1/tlBK5O0emXGxuSf1662dbWqH0aoxpSoih8SL/yZQcsfjAld2beEe9N+jxadtiaH11z8QOspDIiaILg6anw6ltRwOMvae4xtV71SV9fi8osVwNwDiF3CncinRMcOwfyy8WlKktRJaDIIYmjVfGdsFvGh2VV6nJd+FOTQ44mKnDLcHcivGlOfQIlM9qrDR60KsqG+qkV3wg/jOtRBygyPhyy/DeuIHjfVhdVcIB1W835xMaJnT37/0VhRr6lEF8cf6IUwc8ryqZpf9dYLniFxd7x2f5LjeizSuFRwSUiS6fj5HNpJ1yP+Ad8zIwhpn56cA9DS3srhqMD5vbgOpYQNtVoLvuA058xksn6NRQy9Uqm9P8AHMOUyAfdhfeJbbIkajk2kY29g4CKMutFloNjh6MpGrCGB3Luo5v4Yz/sZG6HOJ0SvHhhPG13aaj7UtoUmkJXErCRy4GZ1OOOfExXj3d1iwAa7omG1tseoP4P7ozZJYjHV3Taifzjd2zxEJ/EQiGD8jNrxyRQ6Yyf5PGZqxR8SvV+cIAT4jCcKF+rvReZ/qFHin/UsV1I0J+TkVYhSsRL49Bu5bL/Yv/AFvDlH+OzcBbG94uGXUCYVACeBPjltzVXnHHWM6EHKsAL9vpcdJhBAgOpPBf+hmX1es+JMoFmasLxpLub/gMlHQyvDIGvP1U8+wS05b3PWv+Zn847qfvrzETd3K6GoVgi1hZUqipX1exZTLiJaoGSXO6mCoTAN8oXrXVOQUm+28udf1KFTQyL4WDBia/vX/KJajNhPMtZ9bYQMQQ56K9kSXaH8bGULP41m3D3QCAZNpJ+eZu0hrq+eV3Ovu3WkLVEtCFGzW+hsiufisPI9XQUOhIDaOoLhoFDijcNr/OsmU0XsPuh9sxwltl/z8RD9u6ynOIre9VSAysXTtsHeX6MxbkJn7KIC5xnhExEPQHLKiMEsQIsGNwyEvHWb4 smljw5I8 LQNgy5H5eHGL695rFI7oeIVoZLYOvn5dlYzwu5OEQLRJUvaJ0Z4GoUHw17bBrfW/GY2u1GXPt9V+7+yOTvWBIRl+rSdoDODCVfBbhFHF30Sam5Hi5qjO8PJHIQWsRrBIr6fVHelnDJJfxHlxkTJm+nOYQEU0qB5lDmj49JgWTuRs95o5Hay8WlPy5jwyC99ySgKHk 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: List-Subscribe: List-Unsubscribe: > > The fact that after a block layer initiated freeze - again mostly a > > device mapper problem - one may or may not be able to successfully read > > from the filesystem is annoying. Of course one can't write, that will > > hang one immediately. But if one still has some data in the page cache > > one can still dump the contents of that file. That's at least odd > > behavior from a users POV even if for us it's cleary why that's the > > case. > > A frozen filesystem doesn't prevent read operations from occurring. Yes, that's what I was saying. I'm not disputing that. > > > And a freeze does do a sync_filesystem() and a sync_blockdev() to flush > > out any dirty data for that specific filesystem. > > Yes, it's required to do that - the whole point of freezing a > filesystem is to bring the filesystem into a *consistent physical > state on persistent storage* and to hold it in that state until it > is thawed. > > > So it would be fitting > > to give users an api that allows them to also drop the page cache > > contents. > > Not as part of a freeze operation. Yes, that's why I'd like to have a separate e.g., flag for fadvise. > > For some use-cases like the Gnome use-case one wants to do a freeze and > > drop everything that one can from the page cache for that specific > > filesystem. > > So they have to do an extra system call between FS_IOC_FREEZE and > FS_IOC_THAW. What's the problem with that? What are you trying to > optimise by colliding cache purging with FS_IOC_FREEZE? > > If the user/application/infrastructure already has to iterate all > the mounted filesystems to freeze them, then it's trivial for them > to add a cache purging step to that infrastructure for the storage > configurations that might need it. I just don't see why this needs > to be part of a block device freeze operation, especially as the > "purge caches on this filesystem" operation has potential use cases > outside of the luksSuspend context.... Ah, I'm sorry I think we're accidently talking past each other... I'm _not_ trying to tie block layer freezing and cache purging. I'm trying to expose something like: posix_fadvise(fs_fd, [...], POSIX_FADV_FS_DONTNEED/DROP); The Gnome people could then do: cryptsetup luksSuspend posix_fadvise(fs_fd, [...], POSIX_FADV_FS_DONTNEED/DROP); as two separate operations. Because the dropping the caches step is useful to other users as well; completely independent of the block layer freeze that I used to motivate this.