Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp768453rdb; Fri, 26 Jan 2024 10:02:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+wkwu0loJpFBhMeBgsyqlfzZl2Fe+2tJh5P0wSVP4BmHH2LpFl05qI/HCgf+nf28P+l4x X-Received: by 2002:a05:622a:19a1:b0:42a:6829:c2e with SMTP id u33-20020a05622a19a100b0042a68290c2emr334582qtc.5.1706292126308; Fri, 26 Jan 2024 10:02:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706292126; cv=pass; d=google.com; s=arc-20160816; b=Nr92htTud8rZdlgZdQN1VSd6I1ZhMtQ9E19LKTJZH5dwjl8ekdCJVHr/J+o06F7YNP DgmBnpCBm8507oX8HCvMQYRsd7RrALqixxieWwyBoBU74/r8UuNKE8vBwCkCbzzbyjU5 nMJ8OAIwO9GrfjjLr6SRIKu9BjOGCMu+SK5sfsBoUyNtk0bewy8eKUlRpdIzeqQdHEkO J5G2evHZTAAcH5aJC4oe+hDVFMy6peE4H30d1JHkF6YhoKUor9/CSycZaBP6EhZx4vZH CMU3Y82xMrEZ0eYtxV6VPUvF2m29xb7HhIDsW7UcQkcWcdQ0ZB5avUuMc9Kf7vvz4yE3 U4pQ== 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=1fx/oG5PXDH7ISrPE2BoXtmDPEKGIaT38k7FxJNHTTk=; fh=97WoGDbBrNRyh5Hr5WhZUWkUFutL7x6m9GPduJlcnRo=; b=cVxhSliT5ojzugMSK7nqE6OcK5LwNY2NGwCVqC9qLICrvzBKMKLBLGvGV60OmZuvc/ VlxNjGX0N2J9bv3DBo3V/fl2PA2Apy9vIar4UjTAPaNhb6qzRFYeVT5x+4rFpkLKHhM1 b0m4sfjNPymvshJDlHZEFC29MNMFdachcEPqGvo30hKHZx8B/hhyEji7Wz4OxNCh9VgX i1/aQFBa+CXg7J1gWQI0m4vLacX3qnDVYBk3ErkrPBPqfADSgievtOWjlGqD3xWjT98B ZVuvx++BRcqzmF0WBo4Eqd1cF0ZdNni8sRSKO3jv+sz3cfwJtJ9O/UcDeq2X8LX3abC+ keVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mjBadUjo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40467-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40467-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 r19-20020a05622a035300b0042a600c2ce8si1695596qtw.166.2024.01.26.10.02.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 10:02:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40467-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=@gmail.com header.s=20230601 header.b=mjBadUjo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40467-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40467-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 0761A1C215F6 for ; Fri, 26 Jan 2024 18:02:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BAE1208D6; Fri, 26 Jan 2024 18:01:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mjBadUjo" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 29804208A0 for ; Fri, 26 Jan 2024 18:01:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706292115; cv=none; b=PTC4GwDAZJYnmNpXkCaav91PvXGHINU+CeKxvhU4A1jAbBfXnB0AVoXq51hld3EK8pi6JYJn0DncBew1CRf3GBHmVtbpX0vrK4zqrpWm78bL3CwoxON+R89KPeeGX8RmWVansvdYMZMPjRbP8eK/wOjekOLNC+699VMU4MOyr9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706292115; c=relaxed/simple; bh=F5YzQnUucQZ6fzAnf3y//JkzF0b0m/3coQMZQsPpeRU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LyjVWPro7OGbegBbwAEP40cdSDvv+04vSRieOhXsaM+cQypRrvRzugno6hdPh6OPfT0DxrmT/E0RtCwfGpbp5OAbKvT75zWGkJ8kdgyAcpyxC9HcximiN6KqSVLo95l7EefYsKc2WtqY1sU+kI3cJMyn8gy5/BMdqt9qUE3sPD0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mjBadUjo; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d71e24845aso5898985ad.0 for ; Fri, 26 Jan 2024 10:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706292113; x=1706896913; 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=1fx/oG5PXDH7ISrPE2BoXtmDPEKGIaT38k7FxJNHTTk=; b=mjBadUjoGmrvazxyPWK1UwbFlfHHa1f49rN/GATGtXmockavk1BBZbSw4A/mTgl/tu OYHsvbrfH2AleiJBeMKbDIxP270P2BIEEXxz0nYbX40Hq3x8PuMxfU6tBvy7wBqAk7J4 QcSIKAcDsV2oTrKzj2QUN2Ez3yKKNngXEbulcHynE365LZ6lNSeqUkD1Nt4rle4yuWQT ATLMLJovAEG1IYoyH93Y9SIyvBWZGYMs7Yep2hHZfTTGviY7BYcSlrTSwRd1b90/kBnq U/5sXZXeDTXDYdedDmNCrvMsKjsDq2uXc5Gfq9xyojxrXaGlqXMRXTVeMgo7E/x3Z9At OqZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706292113; x=1706896913; 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=1fx/oG5PXDH7ISrPE2BoXtmDPEKGIaT38k7FxJNHTTk=; b=v8GLZ3TjYOEPl72uw5FVNWz4/OK6OGwkXbDdiaimNBPsX1qaHkUH1hgNT4j8Shawaq 0heniQKcxIYY8jDchZhdSR8XLGxsDWgJIwIt0k+o+oR5P7hovA+jnfn7vfAHxvTEVPpe FDAQ0mnT5PWXMm86mYR0x7nwNPVJUFlfiLgdFR3r66hW5H0zpw3zni2UjlncP9E/t2JB iKc5kmO5pDiekgoT0Uo7/m9XbHXylJk/VvaOjI/YEkUJ1YtyE49zo2TZKGRGqeQIWIan t5COrDMk68IB6gZvOpSFuZtnAYmT1BWI6aNjluQ38sWo9c65rIKR+9GyIOWvIxJA+Agf U5gA== X-Gm-Message-State: AOJu0YxveS654VA6ckxL7IpTyvipO+VrePIZV//clGSz8hbCj3yyqAkM BAWZ/+iT5b5Sey6bExpgr76K6c37OmmY5H44ZEeH9DB8QkZD5FK4/yDyN5HT9XjjXcOrQ4JFDYX AtGhNnTen0nwG1+4Fje9QAcx1egs= X-Received: by 2002:a17:903:192:b0:1d8:aef6:15c4 with SMTP id z18-20020a170903019200b001d8aef615c4mr29913plg.13.1706292113140; Fri, 26 Jan 2024 10:01:53 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240126083015.3557006-1-chengming.zhou@linux.dev> In-Reply-To: <20240126083015.3557006-1-chengming.zhou@linux.dev> From: Nhat Pham Date: Fri, 26 Jan 2024 10:01:41 -0800 Message-ID: Subject: Re: [PATCH 1/2] mm/zswap: don't return LRU_SKIP if we have dropped lru lock To: chengming.zhou@linux.dev Cc: hannes@cmpxchg.org, yosryahmed@google.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 12:31=E2=80=AFAM wrote: > > From: Chengming Zhou > > LRU_SKIP can only be returned if we don't ever dropped lru lock, or > we need to return LRU_RETRY to restart from the head of lru list. Ooops. You're right! I just double checked and only LRU_REMOVED_RETRY and LRU_RETRY indicate we might have dropped the lock. My bad. > > Actually we may need to introduce another LRU_STOP to really terminate > the ongoing shrinking scan process, when we encounter a warm page Yup. This is what I was trying (and failing) to do. To be honest, this needs to be even stronger: short-circuit ALL concurrent/ongoing zswap shrinker scan processes that are touching this memcg (as they will also shrink into warmer regions going forward). But that's a bit more engineering to do. LRU_STOP, which stops this scan process, would be a good place to start. > already in the swap cache. The current list_lru implementation > doesn't have this function to early break from __list_lru_walk_one. > > Fixes: b5ba474f3f51 ("zswap: shrink zswap pool based on memory pressure") > Signed-off-by: Chengming Zhou Reviewed-by: Nhat Pham > --- > mm/zswap.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 00e90b9b5417..81cb3790e0dd 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -901,10 +901,8 @@ static enum lru_status shrink_memcg_cb(struct list_h= ead *item, struct list_lru_o > * into the warmer region. We should terminate shrinking = (if we're in the dynamic > * shrinker context). > */ > - if (writeback_result =3D=3D -EEXIST && encountered_page_i= n_swapcache) { > - ret =3D LRU_SKIP; > + if (writeback_result =3D=3D -EEXIST && encountered_page_i= n_swapcache) > *encountered_page_in_swapcache =3D true; > - } > > goto put_unlock; > } > -- > 2.40.1 >