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 5BE9ECDB483 for ; Fri, 13 Oct 2023 14:02:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E905B8D0164; Fri, 13 Oct 2023 10:02:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E40578D0015; Fri, 13 Oct 2023 10:02:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D08A98D0164; Fri, 13 Oct 2023 10:02:33 -0400 (EDT) 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 BCBF88D0015 for ; Fri, 13 Oct 2023 10:02:33 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 864951CA58A for ; Fri, 13 Oct 2023 14:02:33 +0000 (UTC) X-FDA: 81340603386.28.9618827 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf03.hostedemail.com (Postfix) with ESMTP id C795720096 for ; Fri, 13 Oct 2023 14:02:27 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XneXm3oE; spf=pass (imf03.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697205750; 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=4F4Q1hPIpiSX7DqkBD7+SomvxsQ8tXqGNsU/QJenPxQ=; b=N9ycnUR/ktcugEqZBGimebxVLjxuyf6azmbg04AExFDb/orwQV+NBU7u9EfB0K0ZpTWd5q D8JO0smC/C/+pSegbzf0p0cl4HhkfIID69YRdKyIa18B8+d0KytIL5hERHxvVDnxy92kTY U4pW7YpXrbHWFa5O1Au1phoKORdegKM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697205750; a=rsa-sha256; cv=none; b=YMyJp8xXmj62A3nd1FHbIUW2n0v//L84lR7aYjZ6YxmOjG/s4n4AKmcbffxOKdDjDMtyRJ MFrxRmAc1T9M0ux8dm55726QgQgiISzT7aDhuOh3tZpMEblVkxbBCy8IIC/FPOtmbcLZ7f eps0YqGDDxdHg3w+HMU47L/7bQFWZXs= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XneXm3oE; spf=pass (imf03.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5068692b0d9so2707370e87.1 for ; Fri, 13 Oct 2023 07:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697205745; x=1697810545; 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=4F4Q1hPIpiSX7DqkBD7+SomvxsQ8tXqGNsU/QJenPxQ=; b=XneXm3oEX3NDj85SuDQMiTb1vj1Bs/hllMUWjPbv1wZQ2wfuh4o0mKbH9n5rtJxzEq 4FbNYRDAZkxFRWfFv/YdwxTumM7r9zBPciXG+WjnrShgtCAkW7s3NiyYZEEtBdQ9tivk AJo1ClNnJxGIalJWmcubm++XfUUj7iMOkR+X/5UTEYIoFe+tcLV1QP/xagF/OMr8iSG/ 5L5MbKXRFP6LMrCH8cDxNwzVi3EibD9NTS/1YtKxwXWjR9spZUd0wKeXASwhIC90G050 ZBGlEm0c3qQUdNYubzoqtmffjEwatmGdT8Bz7VFomlKxDcGjAUId90YhxUd0aZ0vayhR 8Iaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697205745; x=1697810545; 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=4F4Q1hPIpiSX7DqkBD7+SomvxsQ8tXqGNsU/QJenPxQ=; b=Xik5MbSnanpm3YzW2vUKc9Aup/qda6bo8exUXw19gheHRCWl48CK9QdcGnGI4eRbzo bIQInkMuNBFskBAkjY6xfI1V7xbeNayOreIj3mgPP/Js+kfdaAqC2t6GTej85OBklmK6 gFzmBiepPNoEf3gWp4yEon7vRrwHSCNBS1MW1jkCKCa3kxoYbc2Tkp59qN5/BQRSGlVQ CmcjUzyqDj/eXh4x8GRWTDgGFsvNL5miN6iXeQuPpAXSzSJQ5XDhC4E7leIzpfkDS1NQ DQX4H8xZPFNPZ1XdhoIx8i5VBxBBs5prUnLi5hkYo7b4s2z7K/vbrfi9lV+2rR2lsppJ /riQ== X-Gm-Message-State: AOJu0YzOq0hJUeUIdTXo0X6aI7/TBAMg/ScPZl32ZIUc0ZY3y4pY6GMI vUd/z0E4mTdnpFjbYZ5XUIkgcU0aB3KS5gY4DazgsQ== X-Google-Smtp-Source: AGHT+IFkuPJBzkLFtf/ZsAorx+3GM/UYYKYlPbN70XihOG+77Bs/KJ0PoObqpghK/P388pCMWjD03CCOxiVBBo52lyc= X-Received: by 2002:a19:6754:0:b0:503:3278:3225 with SMTP id e20-20020a196754000000b0050332783225mr20512405lfj.63.1697205745635; Fri, 13 Oct 2023 07:02:25 -0700 (PDT) MIME-Version: 1.0 References: <20231011051117.2289518-1-hezhongkun.hzk@bytedance.com> In-Reply-To: From: =?UTF-8?B?6LS65Lit5Z2k?= Date: Fri, 13 Oct 2023 22:02:14 +0800 Message-ID: Subject: Re: [External] Re: [RFC PATCH] zswap: add writeback_time_threshold interface to shrink zswap pool To: Yosry Ahmed Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, nphamcs@gmail.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: C795720096 X-Rspam-User: X-Stat-Signature: paeicfnnujpi3cyjg3h9w5r3o87zkeh4 X-Rspamd-Server: rspam03 X-HE-Tag: 1697205747-783453 X-HE-Meta: U2FsdGVkX18cx/z30OfguZU7AMf+IJv/XdBJy/IwUiwHnPm/ECJoGQDaO73P8VDhSZOATHB8rNx8HEDi576pOhz/HEL+tCwQyiRsOKwz50N7yjMEjZRXzjt5mtA02wIu5jqiDEAgXpxzTFarybm9r9l5dJVwO3FWyvpzxpmO1vAyZiR9n6yeHOlg6kmFdCf9x29KxfzB3V8GDyn0P/PK7NBq94XeN7B+tPTOfoUlDtLWZFV97jDOqJYSezgECIU/hKa3I8IAlknoW3icBSFOERL/oPl02/H9ZzACIcUWusiWKbs+TZOMz3ARFXyiIgTMuCqQDbWrbkDn3KwbkGMXXVUcoEGWWZGR3q3QlO10suExIEw7M3xhRNw/NE0jG7DngeJJtwrUOj92yZ9TmlrJUUZIdFVb2lpnaTohPLquk5ZMooLlJtnprOoT6LVgssd6HbGSKJ6Ke/EY5nuWtHOTW66VyVQGKeP5CEI3qUIC+ly511Kij6VIOTfe9AT2mHHf80O+tFJmEtIT8hBuqFngSm8TeWU1j3WG2sWeotzReI8+++4w51NQxeJGbeaguW5UtJfT7Pi/SK4eOmt8CNdGr3x8OI9IE/sUszN96emNncHJD/cPklI2EI8GSNQlU8C8kMiGVn9M0MGUmPYpYEiUvLdUU7UbqMVtAvk/UzC7aNIbTbMI+ylIacMVcNIlGzqdrd94lYL86sIC9DqvMcnG7aSP+dNEATbbwtIl0UoXA3zrNu0cB0sExc1klxo+aaMNa/qh9QKqXAkiUhXhS0qoy/VjgXBY0tUDHQWOdhvAOSCz6Y15asr982gPaoBljNbF6oaS9TzJPygqzuySvbV5lcomjBWE1GD+zyeR8WZ0d1rUq326sLEs2Y3DqqjGLkqXJMPBCg3TTQCfN0/D3qlcWaxX8/XLvKDFZ7VZ1rH0xts/4mdtkS7bOEKVfjX5lC8upDPilD59gwu9O7ethQh L5Jn/hrQ z4vHRGkTQjHbzns018LJStPewFHJG12FGF8XvDu0kZ71CNhrCbT+/cPCfqDitJFuvRt2AKtZT4YyzsqC+VthGxt2CGKSp77CQNrcIVk0KIPDAF4LeDZnyNwuWN+7AWIdiqMlag0l3PKRoA+B/ZIr0NJTv4N8cpYIXZm+7YtFb0xgAwPOJDhsQbXdOkidPypV54tyyMaLuJra+b5bk6IUD4AN60w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Thanks for your reply. > I prefer if this can be done through memory.reclaim when the zswap > shrinker is in place, as others have suggested. I understand that this > provides more control by specifying the time at which to start writing > pages out, which is similar to zram writeback AFAICT, but it is also > difficult to determine the right value to write here. > > I am also not sure how you decide that it is better to writeback cold > pages in zswap or compress cold pages in the LRUs. The pages in zswap > are obviously colder, but accessing them after they are written back > is much more expensive, to the point that it could be better to > compress more cold memory from the LRUs. This is obviously not > straightforward and requires a fair amount of tuning to do more good > than harm. I do agree. For some applications, a common value will work, such as 600s. Besides, this patch provides a more flexible way to offload compress pages. > > That being said, if we decide to move forward with this I have a > couple of comments: > > - I think you should check out how zram implements idle writeback and > try to make things consistent. Zswap and zram don't really see eye to > eye, but some consistency would be nice. If you looked at zram's > implementation you would realize that you also need to update the > access time when a page is read (unless the load is exclusive). Thanks for your suggestion=EF=BC=8Ci will fix it and check it again. > > - This should be behind a config option. Every word that we add to > struct zswap_entry reduces the zswap savings by roughly 0.2%. Maybe > this doesn't sound like much but it adds up. Let's not opt everyone in > unless they ask for it. > Good idea=EF=BC=8C Thanks.