Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1400351lqt; Wed, 20 Mar 2024 02:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU98oLLOsaYD/v+jvyvWG3lgOiOaM2dr4OeHvG8w9pHArhQIADQpo88AA5Jkn1iEVi+5BNASoZDhVWLyX65GTFK2aBtK9oHR3mLH6Kqpg== X-Google-Smtp-Source: AGHT+IEy5McWA1iQKeFk3ujLcN74X+6H0USiGCB9fSMuiI6HPbuoKrEDEAwg2jhDlBgH+M9fpQ0Q X-Received: by 2002:a17:902:e5c5:b0:1de:ff9f:aee9 with SMTP id u5-20020a170902e5c500b001deff9faee9mr16148622plf.11.1710928286447; Wed, 20 Mar 2024 02:51:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710928286; cv=pass; d=google.com; s=arc-20160816; b=By5SBUmxzw8nPZ5GRkAabc5xtVpmx2fYgUz3qEYLzRPDuVm9Z/Tt1+dj3+fzB7iPS9 WqFuSD+19exD+pEeqObijwSMl/dfQ5O8vttHl7BMFzUsmaIiqHjVBY53le5QtHPjWjCN fxfPindO1YBI+U0rE0GU4TMcEYUxlPGa1npxjbK7grN4IdEv7Ra/jtUqb//H/51FSjLT 3ROalcQOKp0owOsAJ4wZY1Je7J1K+RyaxAtFLLPlLYRuSkjXaownYBILpKdYkeFZQol4 QNssokDSw7vhiYY+Ae7ASXq4MLoo/a24bgjumNCqV/xg/kLBeSU8dlOHbfVzDqnzj7IG f6cA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zjhq1PEVAhGZ2kdB4HfNLj6p/IGSV1YaiQEcKC9VuRs=; fh=jxDh0LwS2Z15+LTQkpYupm3mKBldIXuDyDX1JvxsfxI=; b=VOsO4MccY+OI6kxLW4P4/h9nv9Ag0fYC8DKGzri4W5/GEGDEK3VkGqL2H5POHdG4At Q3N/hkzNvOc1jdKx6MOSukrPX9sRs5lM1kOvxxfLfB1CawkMt/0N7xmwxiF6RQlrOWyn dmbft0f6Xf8Bxc6KfJWrbdhhKlwUPqrs/NPvwyQkEqSCeUwdcFEDI2aY1zUQi5k9TLxR h/AjNQgb3zhyerou79qe7JvQw+oDnRKrzvDp8RG4UGg1OL6Br8bKoAXzSSxngL3ha/sS ARhT0m2C3ju3QIO59L29Ybqeh/up7UnN/KoIwaYAgCZyfba143ICEDyin0IsbvLjP1z9 xC0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=af8FPEnj; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-108716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020a17090311cc00b001dd63fe7f59si2463685plh.35.2024.03.20.02.51.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 02:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=af8FPEnj; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-108716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 25902283C55 for ; Wed, 20 Mar 2024 09:51:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 464B23C478; Wed, 20 Mar 2024 09:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="af8FPEnj" Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (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 ED66B3C08F for ; Wed, 20 Mar 2024 09:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710928265; cv=none; b=EewCwJ+0Yrbqpv96NB1NkrqLH91LsTplAz4Q6ZkfLhLj1QvcjbJLa1FvHWU3VDrnqAWnOzHzC73FBSO35PPp39656MpeUZkzyiI4kE39HY2zzi60i8zHEjZyiUeCkjaHCeREzjUAfuBHOHM/OXz1rPKHEnu6yalndRJbbF+zhEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710928265; c=relaxed/simple; bh=aYvUqauW3XAIBf8VauVB+YWLGD5kYr5o2CXhUs1LuqE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dGQImUtPC2kSGpq6pzIq8YnayPzBLozILCmMisaDcYLpZe7K32jZ0dIgTkbLIW9HT9SUuSBL9zgLtWZm9Qxk6/zUD5AjEfDf1C78AzXIO9dEIQTx6LH+DSgFJ7vc8WzcjzYTQP5AlEyQ5+lWKqSAR+ztboaAZV18fvt09eJbzBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=af8FPEnj; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-78850ab4075so262993285a.1 for ; Wed, 20 Mar 2024 02:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1710928260; x=1711533060; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zjhq1PEVAhGZ2kdB4HfNLj6p/IGSV1YaiQEcKC9VuRs=; b=af8FPEnjpJHDPR//+n5dPfAQ4owOylqJsR4qmlIO6ztQE4UmL1VvnIlPYiFaAk/TEH bS+FtONd1jOZ5XmOOE+EZnbpZ+ut+ZruOp+O9kKN/DhctmYMQoOEdZhXdZ6lWLNhdIiI kok+k8YvuhXzVWdxRfEiRErNeS3g0cjEiifWeO0+qPYu0NxSmxUPh81E9N1ccpR+tino 711IqB12kYzH5dYYmmTgSxuStEkdoISTPBFQx0chqyM3eDG0dGy/EPTQMY7veeU9xRpB R815831rpV+E2c6IuKNs+nK5dteRmoi6Ksyid2dW7AoL55mWh89kiT4h9Qrgxt4jQRjM /CAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710928260; x=1711533060; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zjhq1PEVAhGZ2kdB4HfNLj6p/IGSV1YaiQEcKC9VuRs=; b=wQzWdJaLDyt91e7AG8oUTrLsCSyzUfrwCLHlfPKtXCmC9DgrhkVGu0/+dxGXFhwIkr 8yn1AuYhaqAYB9UyYB4V9yCSOi1aFdzL4dxATUu66PbAkjDo5hRKBbthY1E3NzQ/pQEu JRL1HYvl6Yj8A1chmjm3B3cq36NnNYdYBgTSDzNICvt8JRj67zkrPVWBWa5kfSURwQLq 67+9OixJI0Rm9LCF6yo5lCHvar99Z5nM6KBGOUqOA/8ub95m4z4fuhfphguhpSsQo/27 l1254DwnbO7FvY2k45UW6KuKfJnkmgWqBypdwAEAXYgQbhyvpP7oma9vEGLk2CE6om7m q29A== X-Forwarded-Encrypted: i=1; AJvYcCULIgg96ftIXe2Duce3EvZSWfDahEgXhGsOzKoTshQ7xnsSTdnCzcawGtIIyCr1eOMprpzH5N/SobvotuXLV6MnmJhodKb+Kk8XoAxo X-Gm-Message-State: AOJu0YyL46SLSv22uSGlvQyQ0kkiQBLH4F1at7EgZMeoXuKNbazQiZH9 +HPgfZ1WZqmaiga1ragWfTqMTxjatYjX9KX+wYuN2gYhFrYk0YPqjRNVtT/w01I= X-Received: by 2002:a0c:ef86:0:b0:696:48a2:9cd9 with SMTP id w6-20020a0cef86000000b0069648a29cd9mr453563qvr.33.1710928260485; Wed, 20 Mar 2024 02:51:00 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id q13-20020ad4574d000000b00692bd4905c9sm4943884qvx.15.2024.03.20.02.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 02:51:00 -0700 (PDT) Date: Wed, 20 Mar 2024 05:50:53 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Andrew Morton , Nhat Pham , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm: zswap: increase shrinking protection for zswap swapins only Message-ID: <20240320095053.GA294822@cmpxchg.org> References: <20240320020823.337644-1-yosryahmed@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240320020823.337644-1-yosryahmed@google.com> On Wed, Mar 20, 2024 at 02:08:22AM +0000, Yosry Ahmed wrote: > Currently, the number of protected zswap entries corresponding to an > lruvec are incremented every time we swapin a page. Correct. This is the primary signal that the shrinker is being too aggressive in moving entries to disk and should slow down...? > This happens regardless of whether or not the page originated in > zswap. Hence, swapins from disk will lead to increasing protection > on potentially stale zswap entries. Furthermore, the increased > shrinking protection can lead to more pages skipping zswap and going > to disk, eventually leading to even more swapins from disk and > starting a vicious circle. How does shrinker protection affect zswap stores? On the contrary, I would expect this patch to create a runaway shrinker. The more aggressively it moves entries out to disk, the lower the rate of zswap loads, the more aggressively it moves more entries out to disk. > Instead, only increase the protection when pages are loaded from zswap. > This also has a nice side effect of removing zswap_folio_swapin() and > replacing it with a static helper that is only called from zswap_load(). > > No problems were observed in practice, this was found through code > inspection. This is missing test results :)