From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C41ECD1292 for ; Fri, 5 Apr 2024 02:54:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 547EA6B0087; Thu, 4 Apr 2024 22:54:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F79E6B00C6; Thu, 4 Apr 2024 22:54:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BF7F6B00C7; Thu, 4 Apr 2024 22:54:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1E82E6B0087 for ; Thu, 4 Apr 2024 22:54:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C5FC0C06C2 for ; Fri, 5 Apr 2024 02:54:11 +0000 (UTC) X-FDA: 81973959102.04.33039AA Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf13.hostedemail.com (Postfix) with ESMTP id A6E042000D for ; Fri, 5 Apr 2024 02:54:09 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="m/GMbLQh"; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712285650; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=t7aECXqPEviHQhu5pIAJUJtLLf+Cx7njO7rHYd72qcE=; b=PLWIlB2TmkQzwF0RcHw/jH4gyiuwK1OOnfvgZIw+DNKNQfLfYpv8vuZJlXxmBvtRKXXGfe DVoXAQ9jMXSPxuT/bgFDSMSeRJkHh+jvFUmHcIDg6S5VLiEdZLA/jCwT/7hAMhiTWnLHdT dGfM59kA7KzG9uBy24n3TrLqs/jgDNI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b="m/GMbLQh"; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712285650; a=rsa-sha256; cv=none; b=iybzc7ZUiz1XPSeDMqnCewt2gAa04N80e4/setxIRJvmclCG4s6sQo9PESsL5unCQjq5w5 Y7StY+nFVmUN4mFb8er250F6XAOovJJqWmeQ2Vggp83g/MApSake/cJUyVTI3M8Dhh8NEt dCxnzwi4s3QFXzHLlwnq5i2EaY8IV+U= Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-78bc322a55cso106342385a.1 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=kvack.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=m/GMbLQh2Ol1wXR7esQ1erEy3EmwzBP4JeMuB0lJpSfiDSLsiqxCn+6eQeOOxD6rIu 70eynSBq+r+saqA59PD2RDfDtRrtJDB8/2cytoMAdLpH3HNLgaxtQrn4IciF9jkkNP4r 0YFxviHpOIzZYY0jp5Df7MvXurs4s15c4CjJk56qkfSPzI3BdrXIHgyS7capybK3zV/o UC4V1+NGM2O15y39tKQtinQ28XLICP/qJvl6SJqFkNswkawFUDioWeuLL8MrI+5DCukg CredEt4HAvOb4iSoxo9i0esfYNGWHeJKm6sVDLG22YITMJFWg2IZPyzQi8NnvrZDt3Et AqLg== 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=Pvjxmcvv1JuSt0U2CqkyOh34vkWpHElm5pR/1TtYQMTcFWhUjOKODbA/1HGSp20S4V vFl30M7GcXvS8/nUKHigVEfKzEi8LgVMOwnDyHD+QxiS1/B2BjDgOF2U5O7Fgtuve0Nr 0oMJts80e0ulAQNCOVAAVjE2guX2rNrtpi0H+ygSWCxKrEkQc1ozU7K6INGjcXB1HrJ8 euNCLTWi9NzDBlVPSKD9ZrY9y9quLBvclmz3K7dmZEiyVGkF0A5RtwewEZSQ2rOWFNvs g1g6b++e0PhWu6BLbjZ1lrAt97yJfFydoObFTAYcp7cXbiBVghZP+myyxOud2RV/fNRd qTKg== X-Forwarded-Encrypted: i=1; AJvYcCUc7eL5tvgaXVBLJUtynDtDpnkZx/a/RGLxxVkN1P5xueA6aNUpsfw/9SfZR2TllsMvbOpDODYVjJ5YQnGilOiVN4Y= X-Gm-Message-State: AOJu0YzkTTuOZGhCA97XjkvaUMCkNp9PSlaMapJs1GCCh1XD4EVzk3wQ OxxbGe2SPOR1AVXr4tX407eH0K5KkXulWsQ8iFjHPFtGBs5/hEW33AfUDEnrxcIA0rPVWohcq8w M X-Google-Smtp-Source: AGHT+IGMtv8HVwWRPEiqArgymNWPvBUwr6qurZzqfxu3Mj4nvVlxTkqhXoAHfh8+x8lAl+jBNKKXZw== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240405013547.1859126-6-yosryahmed@google.com> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A6E042000D X-Stat-Signature: ty3fnf53restr83z8z3a5bjtceiy856s X-Rspam-User: X-HE-Tag: 1712285649-617975 X-HE-Meta: U2FsdGVkX19jPkGGBumvlRBZY1Mr5RvOoRwXGbG9HV6s7UtGWdM16OkLDL1NNM/vqhOjF9+m8ToD0SW4aPZ8KrJVq2BULGfZ7I18S7Cxp7oT3n9ioKC2XUvT3JextycofMrtDLESO7DRF0IDIe7b4Qa73fsTVFaKcoi8bXEwYyocvJK9S1NobR5v9GOmhj+zT4yR8RKbBMoCHK1ZEczeTZYg/D9vRg3aJSOweyyJSEdlr4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KHkXpn/PT3+4q3S2d8A9pjNCZf681TCnI8TUgI5L/tWtGkCXKEtBMil99S3vjq5c3HeCQV5O81guM5S6d6lfRQPOHBO50+1hqX+PkQ/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000015, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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.