Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp441423lqp; Thu, 4 Apr 2024 19:54:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBmtUkbiz7D8KPNf39FhOSkF6iRWXdEMuO8OjyJj9QEe0YlRBPHTAKBSrdsl8vnx27ykPo667uI4ESaYQQA8SJb2EjRTCRfnMVJN7bJQ== X-Google-Smtp-Source: AGHT+IHqoeDvJc6OsHX1mPk/oqwJnsZUK2EUGI1NIxYf3/5BfLagfDl3CXGmOaLHg7idLGh2mGrv X-Received: by 2002:a5b:889:0:b0:dcc:8c7d:970d with SMTP id e9-20020a5b0889000000b00dcc8c7d970dmr83696ybq.47.1712285658675; Thu, 04 Apr 2024 19:54:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712285658; cv=pass; d=google.com; s=arc-20160816; b=Cn+BYWWuet+AHJJ/92N/KJlyDSLwQzq+y5pFkhBktSo7iZJgKTpjFVkZO3Pd1lkS4A E5VaG1DKA8sa/h7Qnl9oJhq3/XFe5Sc0nt8hTiMXkkdiceWv0KDe9g+YdjvOsQFZG3Uc YTMxQAjNBbSSpezZCP+qr25l1bmuTyFvwcEibMRBByzYsnwiBJ5VK72pXnk1un2UE5Wb DDo219oUhD8eXUv8b18mGQ+Z7nGP8Kgad21kj771GNWQd1c6Q2O91EkS6H2+Th4F3AMh 50Vrm8gLshrnNPPldABRdvopPZtFUexTUnS3Z451AVHXnV7fH84GNwkJU3qoe+CHmpdM UL6w== 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=t7aECXqPEviHQhu5pIAJUJtLLf+Cx7njO7rHYd72qcE=; fh=4xy4L4K210ZepXaDNBoFsVeDdAw2JAzbVmchmfluwbE=; b=gln1tUPDwOVNBwZpddlcjZxAlZywDwYkSJKNsX0VD/F2BxykWmjj9ZodboUSxG9HB8 DRDQpM2OLu9lRgPOTBaz/Om4UjCxxnRAn6Whp0OkUG7W4aISe//G98lW9L9z4CbnuI3P vjTBiwITzGG6zJEGVawqnaTsCt064EsMn65HTnrgVYjj4ghVQN7CoSRXBXqJMtYTS1K5 +eTkGWr8eE1zJjPYd9ymiabEn0Jz5QKilOlqu/gH1YFfKaP/GHp+LjtrJhnNCbKq9KMh cJE5ahOP9SU9ey5M27BcPv5inRH+HoVGom6w5Iy+WsIMlLDUZKLGdtKVZDcsq7uMjRQM nWLg==; 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=ffWD3uZS; 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-132349-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wg2-20020a05620a568200b00789e14dcb79si768909qkn.402.2024.04.04.19.54.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 19:54:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132349-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=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=ffWD3uZS; 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-132349-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132349-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 696E41C21EB9 for ; Fri, 5 Apr 2024 02:54:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E9B117571; Fri, 5 Apr 2024 02:54:13 +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="ffWD3uZS" Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 D61F5134A9 for ; Fri, 5 Apr 2024 02:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712285652; cv=none; b=K2q/UFHb6dlc8fWk0Pwaw4OzZ0VfDdpVxsWjuztEMr69FnoRRocM1yUagJbowIZUH2TgYuEXJQcAR5RVWwqC5mQTie54dIoUwYn0HHb8pHb4kqAutB6+krQc7flPBFHTNigGxCucLd6urSzq/k22WaTJvLBfuWgwNKaA1bdW2x4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712285652; c=relaxed/simple; bh=6fIOr6xwP89e85fVGuI+zgzRY7BLn0WGoP9hEmgJiY0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AiA8LkvfDaAd2ldiuAUqH7RDN9sF7ysIG56CLYbaLC4lgl263SXano6OFZUxCpmiA+d1SUWEIx0Xr4PWnpH32acr4yD/tRVaRsjySKjJU+SIIfMnezELWH3GQKgEI1KOZrQpnyh6f/oTMioY0TzHQGwr6/tT2T6VUftecwEZ4yg= 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=ffWD3uZS; arc=none smtp.client-ip=209.85.222.182 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-f182.google.com with SMTP id af79cd13be357-78bd22f8257so102120485a.2 for ; Thu, 04 Apr 2024 19:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1712285648; x=1712890448; 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=t7aECXqPEviHQhu5pIAJUJtLLf+Cx7njO7rHYd72qcE=; b=ffWD3uZSnfBUwcqfJHh2/8VQmdPh9OPSFydepskKHohl4MNllcvihepiMzUMA6xbrg mXLXO3oWpPqceauawin0DQ8FMZEjN0Pfg/ITVYz7MPNm4ABxpuWQwQPRIiXyDnDbPouV +SUAVfy5lVidk4iHvDUdGubtlNow8JATcHiOp0f/0oN6s0BC3L6tJ805XY5XpcqkS+71 6tDY/57Y1px6eWy2iftJAjWw3AGqKoqzJVUQeJ5bR1pJdiY8YUBGDG0zSkuNhkkh4qQ4 seoIUUu1g5dBmgMfJ0vVs7DqcQhqqqeibYlDC1ItwQ5wpXX1uAbwhjZfoy4t4RCQDiQr bpjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712285648; x=1712890448; 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=t7aECXqPEviHQhu5pIAJUJtLLf+Cx7njO7rHYd72qcE=; b=NZ8aAHy2VEr7+B7H2qB4siiu8iHgbeUZIGFYTE/UF3ZNsHCFGKEu1+D1T4fWHY3ChE iNLNERjcWeydGsVMpoGkg2sxKwRMB2+JU8YrL3FAsf27/USVKXx9RtfRmP6I0cVFxcGW /mofoB+Olp2kUq8MFoexBVQ+si11iGlCDsN8LCSnvM3UWafN74tHm2E+7/weARMFnyK7 5xgeP2JU9mQnkAHrZCz38KEe9+Od/o8seJ8dwqIjeTS5j/8pAiQKyLQcCwGkIL+stkz1 dOn1wGsbzqIhG+1zVYfTPulPl0CRNa2uEB29kTxPl+aTpV+AoaGxJxbLeq0ILtyeJMsN /Opw== X-Forwarded-Encrypted: i=1; AJvYcCXrG47qD8AO4kJnlYx8ulKSnYhftdlUhWvTBv1NrYV/p8EIOfDD3awn92/KOMylsKuDQ0I/egkFm98LD2Hckyquq75o8b65wKRdXK6T X-Gm-Message-State: AOJu0Yzv+DANfnebHfXHNJHThRrC5ku9mKO4BKOEOCtYvOLpSkPoIzjp JhzeiVbk5RjIYi1khGx11hA+A9zDz1UHYru5pWOxfK6IU+iINLtHBpzuhPIVM/E= X-Received: by 2002:a05:620a:29c2:b0:78b:e6f6:737b with SMTP id s2-20020a05620a29c200b0078be6f6737bmr326656qkp.62.1712285648709; Thu, 04 Apr 2024 19:54:08 -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 wv18-20020a05620a5a1200b0078be30219d3sm277560qkn.74.2024.04.04.19.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 19:54:08 -0700 (PDT) Date: Thu, 4 Apr 2024 22:54:07 -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 v1 5/5] mm: zswap: do not check the global limit for same-filled pages Message-ID: <20240405025407.GF641486@cmpxchg.org> References: <20240405013547.1859126-1-yosryahmed@google.com> <20240405013547.1859126-6-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: <20240405013547.1859126-6-yosryahmed@google.com> On Fri, Apr 05, 2024 at 01:35:47AM +0000, Yosry Ahmed wrote: > When storing same-filled pages, there is no point of checking the global > zswap limit as storing them does not contribute toward the limit Move > the limit checking after same-filled pages are handled. > > This avoids having same-filled pages skip zswap and go to disk swap if > the limit is hit. It also avoids queueing the shrink worker, which may > end up being unnecessary if the zswap usage goes down on its own before > another store is attempted. > > Ignoring the memcg limits as well for same-filled pages is more > controversial. Those limits are more a matter of per-workload policy. > Some workloads disable zswap completely by setting memory.zswap.max = 0, > and those workloads could start observing some zswap activity even after > disabling zswap. Although harmless, this could cause confusion to > userspace. Remain conservative and keep respecting those limits. > > Signed-off-by: Yosry Ahmed I'm not sure this buys us enough in practice to justify special-casing those entries even further. Especially with the quirk of checking cgroup limits but not the global ones; that would definitely need a code comment similar to what you have in the changelog; and once you add that, the real estate this special treatment takes up really doesn't seem reasonable anymore. In most cases we'd expect a mix of pages to hit swap. Waking up the shrinker on a zero-filled entry is not strictly necessary of course, but the zswap limit has been reached and the system is swapping - a wakeup seems imminent anyway.