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 ABBBEC47077 for ; Tue, 16 Jan 2024 11:45:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15DF16B0074; Tue, 16 Jan 2024 06:45:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10E6E6B0078; Tue, 16 Jan 2024 06:45:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF02B6B007B; Tue, 16 Jan 2024 06:45:24 -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 E01206B0074 for ; Tue, 16 Jan 2024 06:45:24 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AA3AC160594 for ; Tue, 16 Jan 2024 11:45:24 +0000 (UTC) X-FDA: 81684993768.03.818C69E Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf13.hostedemail.com (Postfix) with ESMTP id 5926220007 for ; Tue, 16 Jan 2024 11:45:22 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=0lV9GplD; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=yJ8JNLIB; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=A536vFk3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=v+qwMeT1; spf=pass (imf13.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 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=1705405522; 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=83bL3UmsaprNcY7TPS07Y3PDh7YlqCXB9W2bN/Ht43U=; b=ofC41LMDDP5eBdItyHq615fi0+hwd810Zc8xeJClMbI6XawGSkHgBfE2tnLZgcGJBF1lDm YXnZkL6Ca2+79KBi9kS93Uyl5rP5rWBBL3NAKvo8i2rPTGryjfh41x0Y9Q38BIrB8UUCFn x2nq4fQtpiSBj4YYSssNwzD7opObHyg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=0lV9GplD; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=yJ8JNLIB; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=A536vFk3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=v+qwMeT1; spf=pass (imf13.hostedemail.com: domain of jack@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705405522; a=rsa-sha256; cv=none; b=UkHZiNePFXjoYFEC5B9gDvhjlumLFU4r0VdWL4PcpHFVKVDVKIepCrkpwYzeww2VvA4tD6 MFxjCb6x7H+9H8U5AF2cw1ai+hOBlmqX1KyvOjwGdyrhtXTZ6aZN+9/EfU/ae93ueWmnvn IqjrxUtPH+butuyoVL9TMp392MzM6N0= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EC0C71FB9B; Tue, 16 Jan 2024 11:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705405520; 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=83bL3UmsaprNcY7TPS07Y3PDh7YlqCXB9W2bN/Ht43U=; b=0lV9GplD+mrgk/IJ/S2gaAtFzBSuKKrJ6visLA/+I3aGzYt64sq9xjwivvNiaMs6Xbrc4t SYd+JuDz7KqNde53QcnysATItdd/NAaVS58RB3ENSjDrn4eI53ehE0mruRhjlaGJpl/TGS ldZeELRDfl1QCfcmw29baR5dyvsQErI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705405520; 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=83bL3UmsaprNcY7TPS07Y3PDh7YlqCXB9W2bN/Ht43U=; b=yJ8JNLIBCs4W4fyuiZWd8Pa+fvn78mPygqgykOOZtsOdtFV/94D54u9+tFGKwWWLPLrfjU Ysv42yoIhJcGSKAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1705405519; 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=83bL3UmsaprNcY7TPS07Y3PDh7YlqCXB9W2bN/Ht43U=; b=A536vFk3gnTNijO4YYz0DzRs4FvEYHjMCeg6LgSJjwjeFdPdf1Hlp6lbYe/7u3zpfS+fkg EyBzQMgbK5HhMskOcPLhv/Sui+caIP+m1NKqVk01vNrm+hXkWgiOeuVm4yY2oIQdVTyzuS 2pEz990omojyzSv6wyIHJQQIz30L7Bo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1705405519; 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=83bL3UmsaprNcY7TPS07Y3PDh7YlqCXB9W2bN/Ht43U=; b=v+qwMeT1ZH7wmyznf9FueLZTrIFbJTPEaZ4zJqJ2O5LskSHbcRUCryODHF74feC7IwgK8P TXpdlPMd79iGEhAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D210A132FA; Tue, 16 Jan 2024 11:45:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ix/7Mk9spmWWPgAAD6G6ig (envelope-from ); Tue, 16 Jan 2024 11:45:19 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 6C3E8A0803; Tue, 16 Jan 2024 12:45:19 +0100 (CET) Date: Tue, 16 Jan 2024 12:45:19 +0100 From: Jan Kara To: Christian Brauner 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 Subject: Re: [LSF/MM/BPF TOPIC] Dropping page cache of individual fs Message-ID: <20240116114519.jcktectmk2thgagw@quack3> References: <20240116-tagelang-zugnummer-349edd1b5792@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240116-tagelang-zugnummer-349edd1b5792@brauner> X-Spamd-Bar: / X-Rspamd-Queue-Id: 5926220007 X-Rspam-User: X-Stat-Signature: scb84t9rknmqtnczafk36gfwkn5m6men X-Rspamd-Server: rspam01 X-HE-Tag: 1705405522-115188 X-HE-Meta: U2FsdGVkX18PJORMT8rtV4WH+y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eaYjec7B3Pft6Il5ek4N0lJr7tIwUbcaxl6HtYhvwr5cDazbzvO+BxWNkJ7FsCc7wK7eKdvNF2PqY1cUno61SuGpgft1AI7ksFtJOZ051c4E2LvoBoBAMJo6BCsfRjSc6UqpUDvmkAFVQcIox8Z9hi25xvM+902DAIwA== 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: On Tue 16-01-24 11:50:32, Christian Brauner wrote: > My initial reaction is to give userspace an API to drop the page cache > of a specific filesystem which may have additional uses. I initially had > started drafting an ioctl() and then got swayed towards a > posix_fadvise() flag. I found out that this was already proposed a few > years ago but got rejected as it was suspected this might just be > someone toying around without a real world use-case. I think this here > might qualify as a real-world use-case. > > This may at least help securing users with a regular dm-crypt setup > where dm-crypt is the top layer. Users that stack additional layers on > top of dm-crypt may still leak plaintext of course if they introduce > additional caching. But that's on them. Well, your usecase has one substantial difference from drop_caches. You actually *require* pages to be evicted from the page cache for security purposes. And giving any kind of guarantees is going to be tough. Think for example when someone grabs page cache folio reference through vmsplice(2), then you initiate your dmSuspend and want to evict page cache. What are you going to do? You cannot free the folio while the refcount is elevated, you could possibly detach it from the page cache so it isn't at least visible but that has side effects too - after you resume the folio would remain detached so it will not see changes happening to the file anymore. So IMHO the only thing you could do without problematic side-effects is report error. Which would be user unfriendly and could be actually surprisingly frequent due to trasient folio references taken by various code paths. Sure we could report error only if the page has pincount elevated, not only refcount, but it needs some serious thinking how this would interact. Also what is going to be the interaction with mlock(2)? Overall this doesn't seem like "just tweak drop_caches a bit" kind of work... Honza -- Jan Kara SUSE Labs, CR