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 93BF9C54798 for ; Thu, 7 Mar 2024 21:06:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28FC76B0279; Thu, 7 Mar 2024 16:06:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2402C6B02A0; Thu, 7 Mar 2024 16:06:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 108296B027A; Thu, 7 Mar 2024 16:06:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0166C6B02BB for ; Thu, 7 Mar 2024 16:06:41 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CBAB2A0792 for ; Thu, 7 Mar 2024 21:06:41 +0000 (UTC) X-FDA: 81871477002.27.1183EBA Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) by imf17.hostedemail.com (Postfix) with ESMTP id 6E25940028 for ; Thu, 7 Mar 2024 21:06:39 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CIhk7Ewy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of jaredeh@gmail.com designates 209.85.160.53 as permitted sender) smtp.mailfrom=jaredeh@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709845599; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dS28P25SwIHWnrOEmZSU0Q8NWerhLYWKq7ax1D0c0RY=; b=ANm5tZgiZ7T3lQZxCBnIHiMcapdVWQXLE2qVUnEJfcE+ViexRObDvOgTtoBeLVCGcvtt8b ApdlYUkABL5fcqV1+and51zR+vLV2kh6pikVpW/5YKpoyja8aztSUPa2LWKHrr3Q2T2yKN Bm2ITsrjnua3vx+QnbMtCyBJj1XtxyY= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CIhk7Ewy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of jaredeh@gmail.com designates 209.85.160.53 as permitted sender) smtp.mailfrom=jaredeh@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709845599; a=rsa-sha256; cv=none; b=H+DfWBGyI7RB8gmkSbaTuZJfqMc6B91198xKWy3bdhQiuQoSgfsqIOdWl3Uu0m56mioHYI 5h7Hq0QtMf+2Xb1olkrNR+TUVWqMAWcwvNAYXSWn6uyBkKVX0iHwDpjSOTw1KFkCcDBav5 CNcH6asGWYp/Caj5YgfukFZVr4IQ+F4= Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-22195b3a8fbso93340fac.3 for ; Thu, 07 Mar 2024 13:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709845599; x=1710450399; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dS28P25SwIHWnrOEmZSU0Q8NWerhLYWKq7ax1D0c0RY=; b=CIhk7EwyegxURYOGmtIYwXgsMkwRxbjhCXYt7SrQs07wKDsAEpjxBzw8II6miyCz7t RYqQEIEj+/yLsvfWjiWhHG43ElZLuVoHlw6hUEN1QQbwpasjdir3Kstoukvi7PrLF3a3 PDY8UF72r1Y+dR8Wh5XWTMC4iFjkuWqLQT1nY33DlTaBnHn2BoBNeYTOBFZ63NCO+fQn rjjBn1bUuNM1r5pyHrA3uvR96Mfwino4w3TujdF7az29qPKAs3rfyh7V4UNEidLpt4fE Rus1Gjf/RddAJmBWLsiizrtQZ0tpze2wI/7MhjkXI2Fmuwc9QfeZ5/JB/C6Mtc8D2ucD KuOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709845599; x=1710450399; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dS28P25SwIHWnrOEmZSU0Q8NWerhLYWKq7ax1D0c0RY=; b=g9/GIWt2xTxE5ugPmFHofyqiYw6rQmizLxrIno7ecz1gF71WyCwz43huxLfFW/5/K5 Km6Y7eZ+q0mDOZFjNUgHtIy+dhn43fSNhDvblQnOlkzZW3ceGzoOtJ2rXZcZXGLrt0FA T02xkytrBH9g3NUoVzAhy2Os2eaARTcTo9WC50/KxNY0XWSypSa+a0eXCsM/glQEBuT1 c8gNNto9VR14+JTgdA6t+aZLZiP7SPv/10w6sptltscFtc2Aaw5KGfEuYD0IfILjh1O7 VLEdLHml1mxD4t07x3m+abT7BhHTt0GPEpS2XR85DWlgPq5GeQL9X3NDMlH36Juar5Lu Ffjw== X-Forwarded-Encrypted: i=1; AJvYcCUOLy/fNmJZPuVO3UsEqJq3+f/bC/p6UcHSTEd3JrJgNJ5MHddVIZZEYwyPBKRtc4tipH4naR2pTgxOfNwyT3quIB0= X-Gm-Message-State: AOJu0YzO9+ns8mWLowuRE4a4lZ46Q4y8kkRmJtumRiIoyyr1xETnANW5 /cf4eSnkT68W1OQTt+XLE+pnFPkalPM87gXBkwHaWxCRiDljTZmKVwctAWOk+QihBld56dyR83r aw0HVcopM2Y4jZFvDfNnhwSl8Lh4= X-Google-Smtp-Source: AGHT+IFqSok4rMxMkWiewAsWDXVBdy9qhGOooGjmEPSQndZGwSV03wZePCgIjrkJ5LT75sluorIUjqiWG06WSG+WpzE= X-Received: by 2002:a05:6870:569f:b0:21e:7a1d:b4ec with SMTP id p31-20020a056870569f00b0021e7a1db4ecmr1375712oao.7.1709845599066; Thu, 07 Mar 2024 13:06:39 -0800 (PST) MIME-Version: 1.0 References: <039190fb-81da-c9b3-3f33-70069cdb27b0@oppo.com> <20240307140344.4wlumk6zxustylh6@quack3> In-Reply-To: <20240307140344.4wlumk6zxustylh6@quack3> From: Jared Hulbert Date: Thu, 7 Mar 2024 13:06:27 -0800 Message-ID: Subject: Re: [Lsf-pc] [LSF/MM/BPF TOPIC] Swap Abstraction "the pony" To: Jan Kara Cc: Chuanhua Han , Chris Li , linux-mm , lsf-pc@lists.linux-foundation.org, ryan.roberts@arm.com, 21cnbao@gmail.com, david@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6E25940028 X-Stat-Signature: fytyxqe4qixbo4b9wpwrm1wf6cnfwzp9 X-HE-Tag: 1709845599-867584 X-HE-Meta: U2FsdGVkX18nq+ifbYCFMxbnNbQhNo9T+b+o2RFSoi9IFR6lVpd3iF4QK0vmqmnP2ILEV+0aXUheUQsAgPT1kqC/P1audyLQqfJOx1Z77f5xieESmjzSuh08L3fzJRjoZwRG57nEDf/mt1Vqm8PtoBC1UYSUlGq3qwiFJ2/6PePeKOkhS0RuM2/s9uMphWlGMHP1oI4ReFynRlKgiWR3/EjEGMz270HpntcEN7p9zBVrTzcshRvCpDr4qWzjmqf8JHjPrNKgSuzKhM+DkbVJKyaX1PcbDa7nKQXLAN0lwUN7oJypeCcoAsWusF6cYWsdaHgKVb2ySJEY/0Ic6q5NUpIiuS2XNNrRYmrMJJRpS8/Y3TIoEY2puuOSvN9E35uXbR2bmkKyAWLgp5ILKkWEVwwwbzPsz3mMeiMt/9B95v3yOdEQnptkqqottYmdYMLuOVH1aDfhEyfqA9qlP6765EuKHHwC559TXJiZZcMbmekVOMwk6tfH0LgZ/A/igRXatYlA95QmgVoFuSSN/70cUSKWRA3NUD+24hCPP0rWDr8HFlQnVn66Cs6x+hjKRgzmGmd3RqSnXCjYQ86/cKEUFZkYxDmOe5/on6NrMCcHYA19HyoXHXT/pZWPJJ5i2exu7Loa50JUGmUOoOQC3adANfId2HYU4Cn0k6tf6PwBzQT31lSyHWdM2O2IFrVLb3f3aMAok2aTO0C0nBpU0Pzx+K2XkuxLZONalZlFXb/ewRLAmgHvq74XH7yXL2RiE3ZJnU4cAVAw63oh4mFT5AAZ+n+4mNyHb9gRi2Sg7k5py2qegSDE4yDXQqhJ5c7Ul8PLIOqqAA+GImiMaaa7+XmxHlhMhnzqzfG66do3uHmU8tX0vTRA/UrmUJnU0394vPHecpLWpRuoGLbT/3EiU3LWU/ibrU39yMwwgqJwW7dKPfbK06gWSGjBaDGCpq/0L6kosKMVYrtmWei2J173Bmr vH+yG3bz QO9A5vuZQjb2Rjd34jNxXRJCRWxp5Xh2GXm7y X-Bogosity: Ham, tests=bogofilter, spamicity=0.000768, 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 Thu, Mar 7, 2024 at 9:35=E2=80=AFAM Jan Kara wrote: > > Well, but then if you fill in space of a particular order and need to swa= p > out a page of that order what do you do? Return ENOSPC prematurely? > > Frankly as I'm reading the discussions here, it seems to me you are tryin= g > to reinvent a lot of things from the filesystem space :) Like block > allocation with reasonably efficient fragmentation prevention, transparen= t > data compression (zswap), hierarchical storage management (i.e., moving > data between different backing stores), efficient way to get from > VMA+offset to the place on disk where the content is stored. Sure you sti= ll > don't need a lot of things modern filesystems do like permissions,> direc= tory structure (or even more complex namespacing stuff), all the stuff > achieving fs consistency after a crash, etc. But still what you need is a > notable portion of what filesystems do. > > So maybe it would be time to implement swap as a proper filesystem? Or ev= en > better we could think about factoring out these bits out of some existing > filesystem to share code? Yes. Thank you. I've been struggling to communicate this. I'm thinking you can just use existing filesystems as a first step with a modest glue layer. See the branch of this thread where I'm babbling on to Chris about this. "efficient way to get from VMA+offset to place on the disk where content is stored" You mean treat swapped pages like they were mmap'ed files and use the same code paths? How big of a project is that? That seems either deceptively easy or really hard... I've been away too long and was never really good enough to have a clear vision of the scale. On the file side we have the page cache, but on the swap side you have swap cache and zswap. If we reconciled file pages and swap pages you could have page cache and zpage_cache(?) bringing gains in both directions. If the argument is that the swap fault path is a lot faster, then shouldn't we be talking about fixing the file fault path anyway? I'd love to hear the real experts chime in.