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 F12BBC54798 for ; Tue, 5 Mar 2024 21:38:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7300C6B0075; Tue, 5 Mar 2024 16:38:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DFC26B007E; Tue, 5 Mar 2024 16:38:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A7306B0081; Tue, 5 Mar 2024 16:38:58 -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 4B69E6B0075 for ; Tue, 5 Mar 2024 16:38:58 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1BFEC80B7B for ; Tue, 5 Mar 2024 21:38:58 +0000 (UTC) X-FDA: 81864300756.28.988B026 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by imf08.hostedemail.com (Postfix) with ESMTP id 82C8616001F for ; Tue, 5 Mar 2024 21:38:56 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UACjXgrF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of jaredeh@gmail.com designates 209.85.167.177 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=1709674736; 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=v6o4AS5i4dOsSYG386hpB2AxO/SlDpTK2KRmhxj3vgI=; b=Iah56qXHB4OVwtg4lY4vrhhLYUxkzKpd7ONtM+FQpHd9HFbnyajrcOfSDtq6vojqque1pj VLgtWSh/cWVDDlknikAmMndlIPYnw69wdHAKHug5tg48pl83ysZQYHASoGwfw3FAG5oZJZ m76dpLpkeutYVm0cuy6nctqhzviWBS8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UACjXgrF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf08.hostedemail.com: domain of jaredeh@gmail.com designates 209.85.167.177 as permitted sender) smtp.mailfrom=jaredeh@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709674736; a=rsa-sha256; cv=none; b=l2ameQjBAEoAQ9yatEa3wnmuZ5eq0v7wDfMYfe+yqzJOpj09dWcMT9ejKDoEMGPVfo5JdV cw9inN2HEzDxbWWhEgGvDEw2bUorffZKB3AjmWgRtr2y2n8Pa1zIUwRVdNZYfcz3gmnr8U VA991eresmLQw2r+l8DHESe2+P10wrU= Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c213690558so446905b6e.0 for ; Tue, 05 Mar 2024 13:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709674735; x=1710279535; 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=v6o4AS5i4dOsSYG386hpB2AxO/SlDpTK2KRmhxj3vgI=; b=UACjXgrF32SE/zHPi30V8BtV0xh0ZvDyOdqwztDq1GSXnJQssneUL5jIozFX7p8jhC iq8t+av2ga/cesyrcUso1ptNH1jd2dJEMMSZQfuf/iQGkBjUxMPoL/bsGfHLlczyce6M 9S6LgrFhqOFoUdn3zVKqfkHH4Xp1ZGbfoosDVPwbKE0SCen1MZvwD5ip8x7jujwgNRf5 TwMl2NbEKDDgsGoY79n7UFObiSpnVGMvmLjShkLLry5FWlaC39oSzJhK7bikOvne7eEs UQYSk6q0wJ/2IWOajR45RrY5Z642rjcMlOYQ1nouo+rpnHRTj0fEfPItcCFUHYVHfHxY ulFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709674735; x=1710279535; 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=v6o4AS5i4dOsSYG386hpB2AxO/SlDpTK2KRmhxj3vgI=; b=d18yJWSvRDE5T+lDS2RcFQBwEfMz+dH4wrayBFf11VTAe8bIjL5dFtq80bS2fKxNn+ +yR/Vic9zWXDI2/HmRF0PoyNnNF028JgUOizrtp0pMPGMX6vU5wIGi3zwuAGvZkdI9zK mUuq/bI9BVbCTLBHEhkAS4+E1I//CG2jfCB+4DOlue51TE5BN3OpcIGEq/NTX/+qP61x Vm1h3e/F1v3cLNFph4J+G85gUFAUNbVCwdGFnZstcDkcy+BciqogcQieoytxXQ4Bpw7a 2WdXy1gv3Uqx6H/1V+BBEWjWD02qOQsXcr1Jpamvis9etDZSodYKvPfpBljYsNy56mJZ 2X8g== X-Forwarded-Encrypted: i=1; AJvYcCVbyWR/FbKYNChitjA0W7x+nJbplwIccf7jzLu+NjurtE3EBE89TeKizY0ZU1VZXe4C7WYZ0yEifYsidAzneOj0Iyg= X-Gm-Message-State: AOJu0Yzo7BYvjsff7q7Jv+zsZ/ZMcvwf76UMNZKldpqfZXnLnkVj/QVp akTLOcQwczasIXf7PWtqazSbRiB3YcMCVn0Xzi+n7GXY3vW+XgQ3uyA/YwKpJ9ft4nxZwx7JPdu pMPSMprbeitL141Ebw/7MhJcf2WE= X-Google-Smtp-Source: AGHT+IHG4tTI6qUDvQZS4aRnR9GReknmvcWufDkipPXBCCg65LwX7psz/gHQN64kKMGthByT9kC80fJqNwodvoAmwf4= X-Received: by 2002:a05:6870:a912:b0:220:9691:dd7d with SMTP id eq18-20020a056870a91200b002209691dd7dmr3620634oab.27.1709674735554; Tue, 05 Mar 2024 13:38:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jared Hulbert Date: Tue, 5 Mar 2024 13:38:44 -0800 Message-ID: Subject: Re: [LSF/MM/BPF TOPIC] Swap Abstraction "the pony" To: Chris Li Cc: Chengming Zhou , Matthew Wilcox , Nhat Pham , lsf-pc@lists.linux-foundation.org, linux-mm , ryan.roberts@arm.com, David Hildenbrand , Barry Song <21cnbao@gmail.com>, Chuanhua Han Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 82C8616001F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 7kqy7jcnwmg5oaa5opxw84jubkwjoget X-HE-Tag: 1709674736-245886 X-HE-Meta: U2FsdGVkX19Cgr3/GKEo75mI+AJOfIWKkftOwNolOLbWeggBSE3KLwF0GqVJ8LRfN+5DEjqpaiJoir7sgdSoYZFsYt+H0C22c+8/Kw7zm1bgm/H95Dnn95NSHfBKBFr5QfSadnOQD4mVmH22ri3KR7HUrfliSqtxjWoE0TSTHXYVj240Zgx/B03Ad/rYNaMy1eeL8xmTK1YF02SaSkNyZtKB+/EBgEj/xKfJPGQ24K41kOTnuGHKZLRJhAuLqjVkHVIONzlwMQoaRP1+gPSYbJGyJgpbXFIfY02XAj65PlL5i7qhCQ7o4VUSp0yrEhDEPi8q3whTGDLHIQbyVyChO+H039ql8v3K2Is+oGpTqRUZUbFwBCZu4EIi5uKgCjBRf2/rCQ+eprttd7NtiBh2ZOapZQo30yh3q4MNVVS8zuJEfvhunqMYp4YLmV8DA0Rudix0ckNZX9k2gUpkZ9386wta5hin7IZt0kFGpGna1EaUO+Lo3bjbnb9XzSS3F0jpQB3CHiEaiLbKDuMX2kAuNQEBPQrom+mRTjlpcp44VYtsXzS9Lvm4R3d8UPF/YQppSUNDkzp8lCqKA2UY68RaSXjNcv2WhsmKLOVyt8T8EFlQvrZTdRVJPsBVa9Ovw6Yw/R2UNc86oT9dlS0bEIjWwVzLEPJzWUS9VSxQ8no+auqht8rXYrjaCEqCqkSeZJxbm48yEq0JTPTG1Xtgg8WfuJ5L5XMvwVhv+61qZOqpnNTUI8mLxwl/bUVhrbBwRVWoA499OZUdj10pAYe6HxfRkScQzDFTQX73Emv8x814HsaeIzFA82vtCqksCnX5Ew26E/1CyuANKnZkiWffp4Gqz0PWs9rbOGepXu6OoSRpCB4W0a92GN+yi/jhvZ5NxaJVelVdcfe4dM5rIiRIfSTJDkRw8w18xpWe9P6CKcc5ilE6yat29Sc+dc2zY7va9YnHKBMttplWFX+FJL94PIP oFyHkThZ +ftY84la+wZ2IjmWTqfRtLD6uQdLiUJ7EhEzj X-Bogosity: Ham, tests=bogofilter, spamicity=0.000303, 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 Mon, Mar 4, 2024 at 11:49=E2=80=AFPM Chris Li wrote: > > I have considered that as well, that is further than writing from one > swap device to another. The current swap device currently can't accept > write on non page aligned offset. If we allow byte aligned write out > size, the whole swap entry offset stuff needs some heavy changes. > > If we write out 4K pages, and the compression ratio is lower than 50%, > it means a combination of two compressed pages can't fit into one > page. Which means some of the page read back will need to overflow > into another page. We kind of need a small file system to keep track > of how the compressed data is stored, because it is not page aligned > size any more. > > We can write out zsmalloc blocks of data as it is, however there is no > guarantee the data in zsmalloc blocks have the same LRU order. > > It makes more sense when writing higher order > 0 swap pages. e.g > writing 64K pages in one buffer, then we can write out compressed data > as page boundary aligned and page sizes, accepting the waste on the > last compressed page, might not fill up the whole page. A swap device not a device, until recently, it was a really bad filesystem with no abstractions between the block device and the filesystem. Zswap and zram are, in some respects, attempts to make specialized filesystems without any of the advantages of using the vfs tooling. What stops us from using an existing compressing filesystem? Crazy talk here. What if we handled swap pages like they were mmap'd to a special swap "file(s)"? > Chris >