From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.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 2C9C333F5B4 for ; Thu, 23 Jul 2026 02:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784772818; cv=none; b=cJ6wkjOCBEdz0Tuyipg+3QgF1woqJrYQV1CvI3VlNds1Rg9ErXTS2hyGG++U+IVOqZC335N543OrNwk87aDSnxFCrKuHlzG43A8GIVgzMic7eaSVqeVSKZGeMf0gOXunm7g+R4Xyjmd2dNbejViPT4vkTx+iH5Oc0q/2c6K85jw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784772818; c=relaxed/simple; bh=Pb3YkLqv5VAJEZhN7Iy5XU//vgxrVXvJTwFLEhbQAjA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IGIWuqQ0W0aNJRqR/yyHa0z3r2USc2raRGrqxluPD6GTv6TT/Vj+bogoJFB5k8GfblhGNHi0Q1duSk1u8bLfmOS8HxGW3j/ODBePP0ODqTrs02p7K06Md3zpfj/2+OMK8FKNhKTBB+Qfcg6sM7pTU0iL65YCHLjHY+qQn+2oPgA= 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 header.i=@cmpxchg.org header.b=LmPFJl85; arc=none smtp.client-ip=209.85.222.169 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="LmPFJl85" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-92e5d6f35c1so17262185a.0 for ; Wed, 22 Jul 2026 19:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1784772814; x=1785377614; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=63wl+OLSuyt8DrGkM/Vj7SgGoUiR2AzArICs+kt8mlg=; b=LmPFJl85NOZyZkDAtdb5wzRXiTTLyaCxPHIbFmu/TeET00oYZ38w11hDRcOyCzsD2e tCF2Dra3xZfV81mdckJa1l7zt5QlYk7/IggxXpeS9CVwiw4SFOkKpm2BxZy8Ngpwpnnw MtB74ja5MZwXIwMdBuBaVBYqHrSmy59qoRUoZE7/TnleNM9qlQry9ulVApCDN+peU5MD TPGoOPiSHnuvkxoLEWN2BwOhLaT0h40EE1T8QH7OE6btach5aMDAPmi2JkyV1E8OxZ4U +4m4gZ2HPsolj4OrAr3VFSUs9SuAZqFotEKdpj4bpTYNTxOdkzu0VmQ2gt7O7mofNyl2 qHcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784772814; x=1785377614; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=63wl+OLSuyt8DrGkM/Vj7SgGoUiR2AzArICs+kt8mlg=; b=ODu+xZfFHXOic9TohQhd/D6C7KXVWoDS3z24eDFuuwvl7boeURP/1heR0Gb/IUre7O W/h9uzKxIaKOMXXYoAxv3IKwQY5c95efPtKqYTC3lpUG5hTCfA9zfrAGsvUGYXgZNKZT D+VqcbWw+k1zUoABISgF3DpQvdcW/63axp0Z3XlYefU/GtNLooM2G7ceJHfqotF4vaMN YkHQSwqAUWe9EbPMZ5UPc/CGGPjGZ5s3IUe9/G16ZHwogV0aihYTiQna8/xr4ZrIcMI4 ohL9WvsF9NDelFNt4E0N12D61vuPJE+ZKZUef42xlIwYB2zlVfoQdbc4qOftp+5C7MH4 VT7A== X-Forwarded-Encrypted: i=1; AHgh+RoBGc9MhsSEVFG1vwOhro9EfMnMLS28EVQEcAvWltZ9GRdZF27UTWypp2mJAPSKtNXiczBOojwa0227b4M=@vger.kernel.org X-Gm-Message-State: AOJu0YwDMXxHO5FeeRjmj6Mu4vGk3DGEHIKvXrsASQDXfivIvFT7k6jX Kb+lTft5ZI7A3g89uP8fZh5+aX1+E47i2SenX1TwVHU6090Yf0gshIkWPJBnVuUSIbk= X-Gm-Gg: AR+sD10FvLVMSg936KMMwUkhD7c3xVSk4J6QCZ8pkOIRkPuITYl/WNO52NLRqA1P4PL bqXdUjL9OMxxQM2PZJ5lYSssubNhIYzxKkZ0Fyj1eCd4y4fdJj4p5Ml/InKOEWqAsO6hJDOxVTE dkgtOYFGUXX6AWcHJQKtp3Gl6xyj6QcwpN/c1f7TPJKyoOk3oxF0+fQcrPgadldnK76h7DrR4xT nFerk/LLDUVDNEbYfvkZruC3Qd8fFlWehvBFqvECG2qnqj+HBd1FlqzT6+KW7E8oOt34TiDGKj7 kFew1bcaTEBAvWgtP2TGpr9Msln6OBppVrsSLAOgSm0WdaKkDo5mO+1tQs/gkTrFwm5GOHOmN/r i3oUEJ4WJvqhnIdDyYqgGbZeW5xn+NeOAtvFY+qU/ibeVhIQ/BEx7/BpvIU1Q0dDqwAQJZ7LOYC HH X-Received: by 2002:a05:620a:1726:b0:930:9a5e:bbc3 with SMTP id af79cd13be357-93103aee31bmr115743585a.49.1784772813954; Wed, 22 Jul 2026 19:13:33 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id af79cd13be357-931062c4ea8sm22128285a.28.2026.07.22.19.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 19:13:33 -0700 (PDT) Date: Wed, 22 Jul 2026 22:13:29 -0400 From: Johannes Weiner To: Hao Jia Cc: akpm@linux-foundation.org, tj@kernel.org, shakeel.butt@linux.dev, mhocko@kernel.org, yosry@kernel.org, mkoutny@suse.com, nphamcs@gmail.com, chengming.zhou@linux.dev, muchun.song@linux.dev, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Hao Jia , stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm/zswap: Fix global shrinker when memory cgroup is disabled Message-ID: References: <20260717085151.22822-1-jiahao.kernel@gmail.com> <20260717085151.22822-2-jiahao.kernel@gmail.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: <20260717085151.22822-2-jiahao.kernel@gmail.com> On Fri, Jul 17, 2026 at 04:51:50PM +0800, Hao Jia wrote: > From: Hao Jia > > Zswap writeback on hitting the pool limit is broken when memory cgroup > is disabled, because mem_cgroup_iter() always returns NULL. Therefore, > the global shrinker shrink_worker() always takes the !memcg branch. > After MAX_RECLAIM_RETRIES empty walks, the worker simply gives up, so it > fails to write back anything. > > Therefore, when memory cgroup is disabled, fall through with the !memcg > branch and shrink the root memcg directly. > > With memcg disabled, shrink_memcg() only returns -ENOENT when the root > LRU is empty, which means the total pages are already below thr. In the > absence of heavy concurrent zswap stores, the loop then safely bails out > via the zswap_total_pages() <= thr check; otherwise, it will resume > shrinking the memcg after processing the reschedule check. For any other > return value from shrink_memcg(), the loop is guaranteed to terminate, > either after MAX_RECLAIM_RETRIES failures or once the threshold is met. > > Fixes: a65b0e7607cc ("zswap: make shrinking memcg-aware") > Cc: stable@vger.kernel.org > Suggested-by: Nhat Pham > Acked-by: Nhat Pham > Acked-by: Yosry Ahmed > Reported-by: Yosry Ahmed > Closes: https://lore.kernel.org/all/CAO9r8zPVzMKFbCixxD-qgtRrkFxWVrHiZZeLc=eyTPKPVQgX4g@mail.gmail.com > Signed-off-by: Hao Jia Acked-by: Johannes Weiner