Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp87947rdd; Mon, 8 Jan 2024 19:14:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfqUhg42MSFA1uCS+KxCxqqg19TwsjhIDvi6XnBHGIDTB+fp2N1jO45ZL0/4Jbkjhx/q06 X-Received: by 2002:ac8:5f81:0:b0:429:9aab:9dfc with SMTP id j1-20020ac85f81000000b004299aab9dfcmr1761411qta.85.1704770045527; Mon, 08 Jan 2024 19:14:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704770045; cv=none; d=google.com; s=arc-20160816; b=INNpQ6dbkSzuFniVXfrUKeBPntIVnfQmN+JL7BtAanWbGnTNo/ehJd+7QMMvjK9Bnn f+yTI8sVWQERInf3MXmEzB9tr2qCVri3jzItP0oBlWjrbUZPWsuf99ar5x88GkZWjr+b lNbLQXyqnxw7I7XvJMAdtp/zgkjj0z1dg9ki92AKQe1NuTPLFRDap3UBNRkQRQnIUx+a qe0c8PMGK3kd3XxJ0pOkHHi1d26Iyl84NfX8SiaP4rN4oZ+sAw2xtZUsKI856NOAn7rt haEgmTU5WsC1LuuqzOn1KcRrJejYtUgxOonAgQ46yCIb2gTcGMC32KIC+86dC0KXo/b4 98OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=yaxHGV8oPAH0cXVpb6PujQFrg8LWhnuJG71qH//BYT8=; fh=VPjeaWhTK56LdsfZXUJikOHefBMdya0wizbeYqGe8V8=; b=yGBCo4OGUKHX7W/zkLO0NW3FdixGvnY5ttqzHf+DrcAKcdeBEvDroTDctULNWLHw4g l60KVyJWgyTSD3dL0TbihnwQLLqTSIqmjTaGd1XLQ7q36nsi8XfcGPs25J2hg9Y44fYv CpwX6fY/CT4F1jnUh9ConaDEQwWouHkJg5DvlI3SzLLi+EDfR8SXkPAtIsubzgYfzy8Z mttWsBM0mAUnnw4Zj6/wC8RzR8ZA+XHXPQVeHDq6JV+PNoYplAWRZHdG+iUv9y2jWrFw Z7OE/2KCIHxwEmq7XOXbzKmXMvp/sxr8yNbZgTBIYfsUljP2IuRQTmkCQwX7B0IjF23A zziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=VDXuyi00; spf=pass (google.com: domain of linux-kernel+bounces-20319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h10-20020ac8584a000000b004299e360cc6si1190815qth.586.2024.01.08.19.14.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 19:14:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=VDXuyi00; spf=pass (google.com: domain of linux-kernel+bounces-20319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4C20C1C217E6 for ; Tue, 9 Jan 2024 03:14:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B11B228FE; Tue, 9 Jan 2024 03:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="VDXuyi00" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B62C6D6CA for ; Tue, 9 Jan 2024 03:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50e5a9bcec9so3032812e87.3 for ; Mon, 08 Jan 2024 19:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1704770033; x=1705374833; darn=vger.kernel.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=VDXuyi00FitORXJHbx1IooldKuUw1deuCnDnHJx0NlwzhGLwJrd1U14Be5grm1EfBh vmH0LL9j90S+kPm82XBvvqUY7joT3XDMVYDds8v2btD+0aqEDFI8vnMxo912CLVh/0Yc +fqNRK5rkFx8VkpCXqG4169vFTOoESASk249zzmSlHU6yoaCMpk7k5RDvhP5SV1ENP+a mexpWAqUI15xqe+ZUmlSzPl4/ZzpwVleMOWolovKFkLGWbM2RuDYdhD2TfVXhciBbTqp E49JP641kvMEEr1MwLLiD6S5ZkygBJsaooxpEhg+yeUwq+SD6afik7r2hpGMm7L/sOCG CuDw== 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=FaB6NdiV55UWiyDghMfh6BXztuCAEWeNiurN8QtiY5MbPIJSJWNi5OYzBWsaLpq2mv NJS1R/dzT2zdjoGdBn0pd6kDO9nRvRHkJu9aS9N9wWb9wpumFRC6R0i/Os3otUlgMmm/ nwx3dNLBAN9j5Tg9z7fgvZUz40Musb0u/qjkcjCcxasVE8TRfC046ZHFCfxJPd+Nnyo3 F/T4jRdDQ0EzkpYJ4rW9j2gQMz/kq1cdUuJGIrpTavlk6wh95avppUFW2sWZ7wjBFMl3 qxta6NRpnT1fG9eQCPPbNTvP4Xq44DipjvU4m2zh3FxRv/mVBBKuMRAoL6n8tG/7KxHC 1DcQ== X-Gm-Message-State: AOJu0YwzTaE8T4FDLEQd3Sr6q33CmCWxWotYhUL5vrYu/mjQBSqj1W1e xuqom8Mc/q49Q3bzl0MIDdk/L/LDeDaTYcL5/pmh2zvHk/Vh2w== 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.