Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp556288rdb; Wed, 17 Jan 2024 09:55:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWtJWYw5AFJfE5mlm0BrH8j9S88uMpdtmBjV7kgDGuzIrXb2Djs6zCCxXv60ay60qfaVQA X-Received: by 2002:a05:6214:31a1:b0:681:5629:487 with SMTP id lb33-20020a05621431a100b0068156290487mr6800367qvb.60.1705514149542; Wed, 17 Jan 2024 09:55:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705514149; cv=pass; d=google.com; s=arc-20160816; b=y6wlzgsJ+45btNbhnqDSnVvHKIhzu6HXRkYPwe/9zLh0H+sGD1++olMMV+8QNVsoUn VBQXuy9l6OYuFzzNkh192EcXmoof4M86Z2A4ilVCvMlIYHKoh89a9YvDv2y3XvfZFgaj FANMvRoOpA2Wp1OoPpQ64hPXRsBqlbKFtpBgli+Wv6ruKn9FEPsgaXH0B5gJ8xrqmH6s SSOtLOQE5WJZUgKpgTvgotAmBCWqY4hKPN5TH/24ErBYRF4/+49TkPVGU1WOwSQDfveq K7vbIy4ggx1LhxffKOoUBAu6uhnE/CFVYzjvho1zJIqfNF5dngChkVbMxlgRXPIxy3wb qK8w== 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=o6lyJQcXNI4nwRqnHEy+x5gALQye4rU+3fOlOl+RxMc=; fh=9JH/4iTi1C7MS1HLx2QeVWDQtfgVsZsCFIascu/r2BE=; b=rfJN/gs4d1Z0LupZHJyWTMOsL53zgLkIvj4p18KQwYHr2UnovaI7wjnX6TJjDD5wpz +iCseNJd8FyS3Mu5/tMqXPdkOQYdBTjuIru4YuQyXffFWUQ6kYGQRa2QWZn/9+cx0pzj jIneqe4n7L3lCucNm6mhCWj/ZcKtyT15K2miQvh6iFPFbSaimC/EkV8ipnNFqMvX+43z QBKKChf/XS1GFn10JRY4nork+ZJs5Iou5e+GAsQsj9qSURJvKMe/+axnwAwra3TfBPOr uwJcK/bF8Rb805sp+HaoQFUYZZbfAVLfAG5RW9LEFtuyfc+iwIZhDgzZvQBz7u+WSuW+ hwbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=l2TtbWGw; 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-29294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29294-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a29-20020a0cb35d000000b0067f95cebfa8si8221413qvf.343.2024.01.17.09.55.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 09:55:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=l2TtbWGw; 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-29294-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29294-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E833E1C2116C for ; Wed, 17 Jan 2024 17:55:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AFAF22EF8; Wed, 17 Jan 2024 17:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="l2TtbWGw" Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 D11C022618 for ; Wed, 17 Jan 2024 17:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514062; cv=none; b=qixQNam+1+zSIVS24e15BxQaOwTiGLtb/F2VGgiZ+EYHJuo6hA3UOTpkOIYon2Ef0BxiNzSq8d7aaXV8EfDwoUGrRQaQkFkVvPtv+SDWYyp3p4/eCUbCUQl3ETIzwEoVAVfWi9HBo7EtZ072ywk5w+Ma0kdOHeLKxiPHmJ0XHXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705514062; c=relaxed/simple; bh=A0F3r7n/g83EA1H/XZmI+Nc8UIvkJ4IJdIeOlCXrn+Q=; 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=QO5Jo8efgnUZifIckYjdyErXyDSV5WeIUQzKs8NmAcwiwRyMYCczYIKt6EEeXKU6TWl/E98VNiftb6AzHMthGUgCdLOiLKNOehVmCtXDpNxLsGpT80e7Eo7Gro/kLVWqYyy6hWHmLwyfWV4EZjJX5RWwwCODuNaFYWo4JD2dMwo= 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=l2TtbWGw; arc=none smtp.client-ip=209.85.218.53 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-ej1-f53.google.com with SMTP id a640c23a62f3a-a2d6ded84fcso344631666b.2 for ; Wed, 17 Jan 2024 09:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705514059; x=1706118859; 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=o6lyJQcXNI4nwRqnHEy+x5gALQye4rU+3fOlOl+RxMc=; b=l2TtbWGwnONYtVBMTbBuUGV9/1YQUKMPRrpFRsSSEaZZNm6zD5y6a6jru9v0gclXPs HjrI82ipuQn1S/7Xc/9tWVzCedXbnxdEj2uOlBLPfUDJX6vvHD4ZNwvi1hfTUPbzoOs7 g6qnSg2gAGmfQMqmdTapfGgp8TLdU7XU9/S1qw35xzGrorpBOQtp9pcRCBfvgcHGzMWk pHIgDu3hvW7bICOK5HicdQ+MrNC1lx4P/ACh+EC1yIsROzvtbz3Foy2N8mvXeAtndpqz MD9vwb7tLrHANy+BXt/ztFCDEm9QWCAe7SV0KgSNgcFro3FdKJk9zzT+lUnDHm+F3HKr Lcgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705514059; x=1706118859; 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=o6lyJQcXNI4nwRqnHEy+x5gALQye4rU+3fOlOl+RxMc=; b=Z155aV4rL6GLlyAf47vCCObeMsBQoep+wWOT10hRVq6YuaawQy7seMGbEk5FsiQqu0 RKlcsqgVuCMeXx91ekqhXwkKn+IPxHS+KRigy/6M2w1CGxseRYub940+F2OjD3fW+R2r zqdRFwQiV52A5OXA+svBw5/DDe5AP636Nt81KZ4eDsrB52+tuh6Bdwtjeoghl0Sl1h/Y wy7XpuwsXSx7Wxm/Ekd4yCYHWGoI1o/cNWutnQ+3n7JC2LCenD/8WjYgozGyBe6KyYjh DIjGKueXg3NCPNpr0E+g6q55J7azwc0TJnDs+GSB00jqG/F0oTP0jQTS1ttV8psyNS/w pFvA== X-Gm-Message-State: AOJu0YywvX2g1bxbvtCB+DGgn7OoVo8Yn2hr0iKgL74Gf0nNwkizr5Jv mkxko8wwsIrYnv8pR+2msotKYQb+Ra4Y7U20kGJzTOM5lvYr X-Received: by 2002:a17:907:c307:b0:a2d:e3aa:48e3 with SMTP id tl7-20020a170907c30700b00a2de3aa48e3mr3730280ejc.95.1705514058955; Wed, 17 Jan 2024 09:54:18 -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:53:41 -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 1:53=E2=80=AFAM Zhongkun He wrote: > > > > > > > Please forgive me for adding additional information about this patch. > > > > > > 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 c= ode > > > 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_move_= tail_fn_new && > > > + !folio_test_clear_lru(folio)) > > > > > > 2) __read_swap_cache_async has six parameters, so there is no space = to > > > add a new one, add_to_lru_head. > > > > > > So it seems a bit hacky just for a special case for the reasons above= . > > > > 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 do > > 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.