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 99FF8C3DA6E for ; Tue, 9 Jan 2024 03:13:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D1166B0080; Mon, 8 Jan 2024 22:13:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 281798D0001; Mon, 8 Jan 2024 22:13:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14A276B0082; Mon, 8 Jan 2024 22:13:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 050646B0080 for ; Mon, 8 Jan 2024 22:13:58 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CCF5DA1BFA for ; Tue, 9 Jan 2024 03:13:57 +0000 (UTC) X-FDA: 81658303314.21.61E0CFF Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf19.hostedemail.com (Postfix) with ESMTP id 37BAE1A000C for ; Tue, 9 Jan 2024 03:13:54 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=HKg9ySRy; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704770036; 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=yaxHGV8oPAH0cXVpb6PujQFrg8LWhnuJG71qH//BYT8=; b=dDrY6dff9tAqJ1LUXi7dQYuN50EeBdvn6E9fVszflIeLu2LbOWHW5XKMH9A+9kw1dL59pb GjglXi0v+6YLr2gAzWo4zaAFCfxQJ77STVjb160XUtHBPqUL6iHqdVSeSCL6SE3u/s4jQ9 c6i6+RADM2suDPX/ZpD4ISmqxaVcGiA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=HKg9ySRy; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704770036; a=rsa-sha256; cv=none; b=s4345pTMWzxewVuya/8noINz9nX4MgFvA8JWjim4hPzhz5jT8eImq/hwapaPaPCqKWbz8I gb6l11x+dcpt/d/S1Snk4JBQ7qE+H1TCWJo/eJmU3epiwKBONpUWv860bYXg33m5FYVPvE eHIwevVR+HOvnKnA1ZShTKn3QwQxIVE= Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-50e7abe4be4so3035146e87.2 for ; Mon, 08 Jan 2024 19:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1704770033; x=1705374833; 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=yaxHGV8oPAH0cXVpb6PujQFrg8LWhnuJG71qH//BYT8=; b=HKg9ySRygVjXUdCgtifqTr6I8axW27H9alj8ycDYLsUukyYO9xuTBnyk3POhwqP5lw A0tIRt1asueacMdYCEXwg2dNoAc3laB64yDv2agFzqDMVHdp5HLPbhRqJf7ZmT3wh/y7 GAL5PK7TJrqu6N+VP6s9bRCRibyig+grn2retNu6MMd+tTGjhJ1auPPD3FsA0JpZrQop D9+vo0pGSaJtaDWm+wKsY5Qeb2xzuFGrKxT194mh+kIWdzx5ju2eirpmKWq02cKqeeAu NEHEFK9TilQO6yE0j5YfBwRFA33IpJ/9/FSnu0X6CghsaxcSZA8tBHrHMwCbEm8pJZEV JF0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704770033; x=1705374833; 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=yaxHGV8oPAH0cXVpb6PujQFrg8LWhnuJG71qH//BYT8=; b=cSFQ+wgBUjXCPtWu+FN9faPw4xB7PWe1o5Wzo0Y/FpSHQNvW+Yc11GuqgIShESgsWw mfEDF1Lj2yVRKoXS9L2annby4Vu17fyUPOeKvjnoYscz3EEqVU5Pmx1ShW9Q9A9PNTev BRG5Gmk65Y17bGSJzySR76UxcJDAJxeQE28I4vi4ReylH0vwRYUCWpp/xDECzvMIPAAx tOiOa5AJmHb+LbN5fVs6DH+h8gh5fLofMtL2a8CyXN3OMB4J2/7MI1pt28/32U0MZbhj qA82tPUjOz4FxzBbTMfWqmSnOw1YsCV0zRqC9/C5Q+qfsqK9ejarYT607T+AfjHeCvl1 B1ag== X-Gm-Message-State: AOJu0YzTtNFaHZI90BJQkdvvVv+y5qy9OqmPVnYdYT8sWXTnOgEWIq+T ZkNVNdHGgpDUAy8LbFIUKvJSGYIY00cUC8BOegrytaXZYkKCCg== X-Google-Smtp-Source: AGHT+IE5xOFffq0BDtu3fPMSYTDgcpJAYIMsmG6qgY5nuh+v8UmE63lThALATxhAsro1qO7FkGODkyrfADcY7QxpVHw= X-Received: by 2002:a05:6512:48c:b0:50e:699b:55f with SMTP id v12-20020a056512048c00b0050e699b055fmr1890054lfq.66.1704770033291; Mon, 08 Jan 2024 19:13:53 -0800 (PST) MIME-Version: 1.0 References: <20231024142706.195517-1-hezhongkun.hzk@bytedance.com> In-Reply-To: From: Zhongkun He Date: Tue, 9 Jan 2024 11:13:40 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry To: Yosry Ahmed Cc: Nhat Pham , akpm@linux-foundation.org, hannes@cmpxchg.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chris Li , weijie.yang@samsung.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 37BAE1A000C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8zjtf3pjhx6bxnt7ytyticu3qx153gwx X-HE-Tag: 1704770034-729413 X-HE-Meta: U2FsdGVkX1/GUSQZrExzIls/0uVYOeznJSJa3DLSXc8L55k7/eYKHci8F0iuNQNUQWa6RU9t9m6KGNGrdrT8pR36GC9dLiFab2A2gN8NiSvb9ezD+ImmvpsPoYIncPWQyzHa6jig+VKUu83Z6jjZ0bn/8PdcQ9G8fgKWt9lFI67iXwGcp9AdeaZivGbD/hCyv4etzKkek6p+6YASBbfxrS99eECtXhipkys3OPr4B5Xe2pwfiC65aW37HS7pNkww4eB9Oun6b5zPR9YVTrxIZ16NXEOpvk6HqJDGDMPGnGRubGSfykYiRGmWFVFNxUD2IxCERk/l7KZUkVVuBj5NCPKviE3jYPpEl9p1zGSEmfGpgtDXL89Rbqx42ib5Q9968q8AISM5xKM1F0aIiriEhwQF6Zww0SNseob8hYFQ94+KPgXB7nte9UPcNLVp1HzVvk/qHa/iTjqmLDERhDXBEI9famga7gQ6zEKe9RXw4YuNiMyTyH0hQkinmmd5daTF+rK9p0NEuH4IolYorZUetfC4gbi8ehtX2nqfINvRK1Hu2LHBlIZ9QXf4JtASyXlpkPrORNToXJxulnZryU9QWqjK5YjQISoUXdx6y1MI+iXtFaewcZv2LNPm+UA9IC3PXWFzIARSHA+sQeAdJsTU0k4avCvtri1ZjYnPn+qbC+SN7uBp9tqJwkt5zczAKDkYlq0fdw3bDDzS7VDG+DEWpNQnP0uQypbnofLcDy8HsWSwmS8QiRw3HTlvAQsRUGpAKLU7E84SlsgqjBg4faItSsm8xtuGXicAru8afRV4cFJMqKyVrOw5NBjhHMsV+78gxNeoedlNOFDXXuFcvJCtviXx3ZVxefjmZCM/1Y7lbqmEEaT0fxczApjFie0owKJ+giQ6241p5/d0rIOlHp3iNie0BfKrQ4ngxAV27OOACsG4xYHx52y0W08bu6ObjoArSkF/zBjAU7bWuOzsDO0 0K4vN9yP 1emKtLeMwMorbe6awrKTbtzwriV5jpsU+QELQd2YGEDbhtRr8KDBwFr3aonFgFi6l3HtWA+iw+RMkkviR1rd5yPFTvQRJlh+AjZ/b94dEvILVXuzsg1UejtVJn/xf7sDZsR82CF5X+ncwxkgeQ6t8IrGmRQ/qErzpkSsUEnwH9HlVG1YIW7WlBaAPckw+VWmwMktajeVg7avX9FEPf+x0Eu8JujMLX8bYJ2+BKGoIIntY5nepNvVrqOR36erIaQjD2UDtICImW8yV2TuZYqGR/rYS5n+qtZcdOZNpi7ZpLN08gVaVfe0P25UqNzCnXEGAotu/0TV3J3nMmuga33S5wKltwN6nNZj2I47w X-Bogosity: Ham, tests=bogofilter, spamicity=0.002287, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Yosry, glad to hear from you and happy new year! > Sorry for being late to the party. It seems to me that all of this > hassle can be avoided if lru_add_fn() did the right thing in this case > and added the folio to the tail of the lru directly. I am no expert in > how the page flags work here, but it seems like we can do something > like this in lru_add_fn(): > > if (folio_test_reclaim(folio)) > lruvec_add_folio_tail(lruvec, folio); > else > lruvec_add_folio(lruvec, folio); > > I think the main problem with this is that PG_reclaim is an alias to > PG_readahead, so readahead pages will also go to the tail of the lru, > which is probably not good. Agree with you=EF=BC=8C I will try it. > > A more intrusive alternative is to introduce a folio_lru_add_tail() > variant that always adds pages to the tail, and optionally call that > from __read_swap_cache_async() instead of folio_lru_add() based on a > new boolean argument. The zswap code can set that boolean argument > during writeback to make sure newly allocated folios are always added > to the tail of the lru. I have the same idea and also find it intrusive. I think the first solution is very good and I will try it. If it works, I will send the next version. Thank you very much.