Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp557615rdb; Wed, 17 Jan 2024 09:58:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPw+FqBYlnjLVxLJQIA4RGsFQpIMUQMW0Gewp0IYf297zZAW8HTcWTCBL03HWK/RNGK3Ln X-Received: by 2002:a50:fc02:0:b0:559:d7ed:a711 with SMTP id i2-20020a50fc02000000b00559d7eda711mr787580edr.7.1705514312782; Wed, 17 Jan 2024 09:58:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705514312; cv=pass; d=google.com; s=arc-20160816; b=hZKd3hsdCz2O95nmsVr3Tg8d32C5x9KtiVC3OyhXNY/iFmxI9rQdWo2tdvROrTZqA6 pU0n8VoIv/ctvWCFvqbORtSCrZmVCDGtoAPi88DLc1B/jJR4cnlM9G1XGthr5qFkLmT+ 2oy62ug16OpH7t1N+M76koYPJbejykZkbbjygBMQoumoDyIt+HAiHrspCs02i3A2VZb1 82yOYTENe1s+OzB+dIkiSs6so+BK5hVksFEAQ29/hEXxCYK6sUOAitpnPBhQNkBzM20p Kek+P81zGfaGlJ43TqCJaWNNVpw7P6o9Cme7q4Cgo6MKo0ugvv3N3iKaivj1z2eASdtJ 91Ww== ARC-Message-Signature: i=2; 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=2N3wMQ1N8kNumoIXaU/Gd0BY/kYZ+3Wuem2jd4aYAMY=; fh=9JH/4iTi1C7MS1HLx2QeVWDQtfgVsZsCFIascu/r2BE=; b=ikG7ZGf/OdZKc6gzHOFEpvhgNuqgaGDsdA4DxXaDaAC7af6qkpO1CZ7X+IWV6s7O9o 0odEhkOdrMm4vjD1T4R7+2bfj1/JkLVNSKG90p9fwOirGh0bkdaQSlkj2lAbwMRubRNT 8N+6ldmXomsf36mSKLFY5dwHGO2J9O6HEvaZuDrBdhNe5kK+xq7dHym+woQf3lpmCRw/ xQVyJgqjBZa2em2DmD5pp16FzpPHF46HS6kGU8Xu18vsvBgGQ3a7/sEyJPVKj/Tjghgp j4ppxmfBokVo8Sefw5UEesIkDfs/t2qaYKfrNm7W+IQYEc8RCKUV3dUiOmRvf3m2NC4e LtVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YBRJKlLR; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-29297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f21-20020a056402195500b005592dc24251si3469091edz.336.2024.01.17.09.58.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 09:58:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YBRJKlLR; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-29297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5DDDE1F2668C for ; Wed, 17 Jan 2024 17:58:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02B6322EF4; Wed, 17 Jan 2024 17:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YBRJKlLR" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 944162261D for ; Wed, 17 Jan 2024 17:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514304; cv=none; b=KKG+DVxPK7cI5dsZKgxa5mbbjaKz3gdCvz0rS+Y2dkfrGhPglkpUaSQnAyjWU/YgVFBcDahDuH5DdS+/nzUhNuj5PNIsPGUpdw4U7TnSvrOUQJVsVJ0EOaW3lD0//jbZdmbHx+xN4SHLehglBzfvOzitKnJw/1O6RXJjyJHaKHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514304; c=relaxed/simple; bh=5/WheQCY1GfJ9JRKjt4HIIR4VyIIs5pvPXBbl33C4XU=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version: References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: Content-Type:Content-Transfer-Encoding; b=Ei46QYNtSiifuotYIR/ReggaQr1lTvWUrEIzX1DFviYbNwy+gU3dEfKhuvKH5GolEfkMiKTJiM7hxhDlis3dvi0XyOKASG3WBD10LPa6cE1OYmb7eRHrTIuDbQ7zKA1uQUYINQ5ML66ngLB4XxOsxV+C21OvfZL+11rWKCnFPxA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YBRJKlLR; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e87d07c07so15920485e9.1 for ; Wed, 17 Jan 2024 09:58:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705514301; x=1706119101; 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=2N3wMQ1N8kNumoIXaU/Gd0BY/kYZ+3Wuem2jd4aYAMY=; b=YBRJKlLR8YWSKn3NQ1RH8uogA9tsv76rCbb3LGnqY2Z/e603tmA7J22PSGv+YJPvac 4uFl47h3dKkyj5na/b/eZnlid5DQ59JbixvTAt8uiuarLdhBpm3k6lxHh+zWRGu721RU 6adW8uxXfF2xXidY2CbuVkmbt9ChSB9aq0aTLCuashXRfc/BUOVA8vToUdnUVdZcIEkK pKorm4N9Xlw9yv1vH2WabhCDfL1rdJmgl7da20InfYZMLsaNbcIGp+VdO1iW9PV19enM m9ZX589GtPgDMdBmoaKfVZxHK9VkyPHoowaeQVdAqGwFvA+n25ltMpuWuxeBIPc2yJb3 lh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705514301; x=1706119101; 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=2N3wMQ1N8kNumoIXaU/Gd0BY/kYZ+3Wuem2jd4aYAMY=; b=QCnA6YVZCe3d7yzvOFPFxQtQ9IJwEv5PtmLFbrtltwPMdQbJDe9MDeNK1HChFnEfV7 PGiDXshPOnfQpo5qVVKcp05KnfILkHTptmGdHv4Sq/STKr/7xCRBN3kYO3WA1Numy+Qm opWkffRRpjMk9YoH1j0Ie1A7YZoNpERUD7yk8wYSyMb+p8lETQrXRJt7ZUjO4AFFs9oR /fU36jpiIKaZnAETR4Vihy9uD/kA9+NtlqUpK7BN7dNiJ0iA7/ZvmqIkeCDLq03gtSva Gs/IZ09iE+/j1/dY8o+xu614lIaYwHQ2Ioi09tXk3xprtdQWVvDHPYvxTvs/X15+Ot1n LA3Q== X-Gm-Message-State: AOJu0YzKIY1Uu0R9wplyR9HoqrtzsTB4TVqJb9ES/0WzP/p2A+roTOpX /4ZqNvggvkQBEgg+IOHMoJe57h1Qc3kFSmt9xux3Rkx5puBK X-Received: by 2002:a05:600c:21ce:b0:40e:5b60:9ef3 with SMTP id x14-20020a05600c21ce00b0040e5b609ef3mr5800539wmj.41.1705514300624; Wed, 17 Jan 2024 09:58:20 -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: Yosry Ahmed Date: Wed, 17 Jan 2024 09:57:44 -0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm: zswap: fix the lack of page lru flag in zswap_writeback_entry To: Zhongkun He 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 , Michal Hocko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 17, 2024 at 9:53=E2=80=AFAM Yosry Ahmed = wrote: > > On Wed, Jan 17, 2024 at 1:53=E2=80=AFAM Zhongkun He > wrote: > > > > > > > > > > Please forgive me for adding additional information about this patc= h. > > > > > > > > I have finished the opt for introducing a folio_add_lru_tail(), but > > > > there are many > > > > questions: > > > > 1) A new page can be move to LRU only by lru_add_fn, so > > > > folio_add_lru_tail could not add pages to LRU for the following= code > > > > in folio_batch_move_lru(),which is added by Alex Shi for > > > > serializing memcg changes in pagevec_lru_move_fn[1]. > > > > > > > > /* block memcg migration while the folio moves between lru */ > > > > if (move_fn !=3D lru_add_fn && !folio_test_clear_lru(folio)= ) > > > > continue; > > > > To achieve the goal, we need to add a new function like lru_add_fn > > > > which does not have the lru flag and folio_add_lru_tail() > > > > + if (move_fn !=3D lru_add_fn && move_fn !=3D lru_mov= e_tail_fn_new && > > > > + !folio_test_clear_lru(folio)) > > > > > > > > 2) __read_swap_cache_async has six parameters, so there is no spac= e to > > > > add a new one, add_to_lru_head. > > > > > > > > So it seems a bit hacky just for a special case for the reasons abo= ve. > > > > > > It's a lot of plumbing for sure. Adding a flag to current task_struct > > > is a less-noisy yet-still-hacky solution. I am not saying we should d= o > > > it, but it's an option. I am not sure how much task flags we have to > > > spare. > > > > Got it. > > Actually this won't really work. Writebak can be asynchronous, so > there would be no logical place to unset the flag. Scratch that. We would only need the flag to be set until folio_add_lru() is called (in __read_swap_cache_async()) -- so it can work. I am not sure if it's worth it though or if it's even acceptable. It seems like current->flags are short of space.