From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (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 53F6C333445 for ; Thu, 9 Jul 2026 15:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783609468; cv=none; b=YPchWyEKejcgWYhmkUIVnm7RMOXQtZnvsfAis2nEPmLgz268Jt2FCgpokOKPc8fQ5otY48AJLjk1DXQ3e2aCFFvHzIUjwZWDXtoh8ZLULUA5gQRaTX0eYZSeRasd7fKUWgHOneDsK23OOtRaJWzmADPtsN9aHzD6Cj9j6V4ao7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783609468; c=relaxed/simple; bh=CLG1b+QXiyTp9wRZepf5NQ7+h52yfCipkiE9EHYeuBQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=paNDCoNHZLWmOX92LGMSr9+gx5eAzMVYo8ym3jVQRN8/M6/rExMWAfX2Un17P4G2R2ET3p0WF7Rij2ltfmhz5hPqLNj5OPY/FgO+ZAx5Thl3Srn6j1O1EujjDuoEDcXuU/flCq4e1oLL8J6ldHbNv0x46fNbJNnoTSJYSc2R520= 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=M/V57GL2; arc=none smtp.client-ip=209.85.161.46 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="M/V57GL2" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-6a168dc590cso14221eaf.0 for ; Thu, 09 Jul 2026 08:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1783609466; x=1784214266; 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=C2q8Czx79ilwPj1ckt21CqhzkvzJ8d/ykcAORqubNh4=; b=M/V57GL2f7nBlpgKWU0ZBRQ2aSGTh/Wq0CCPAGIBBfT/DJwxmqaxxar4XOeVKIIEGm FRHRrSgk/Igd8mLs/RV5LJqVAGIwesaJTt6FawBfAEzo3Ae44XS9O3YGf8Y/C1vENIcM 4uAP5ZhvhGAttZJhd1awAb77E8oKYBTYg5lakpt9vkBJSfQ162BSGXOS9LvXMMNTdG4N Y1BYNFGXl4GHT9rLcwz/Wujr8hx5c88J3ALqbwxBBFC/PQvzIXTOLCUC8rhsj7x0dADX 7dBGKOiM6rAF2n5tGRhSiVu8B6v1PTNOymfNqXw6P+72oTT1X3i+LywWyu+G/3irsycj apKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783609466; x=1784214266; 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=C2q8Czx79ilwPj1ckt21CqhzkvzJ8d/ykcAORqubNh4=; b=ZRUocx+ZvFU/XynN0VOVNrWPIHpf+LrAmTc6Q60QW5PLkBrzNmzlKeA4XCMSEzby9F LUzoX04VTiCfK+BBjUir99LLEZzfVfscEjLYPhms3+H0iIhS927A+5aVAQJMmreJNkpH barr5qdWn+EjC2kH8cXFZ+DZXy3xzWv1INAaUjVBIZH+d71P/OF7258Fan1vYXrVdmT3 L5NCjOEb9CKL7aIXCtGAxzMp2aax8uDVIVpTlfoLJ6IDvAAoG+v/SVBCACE+4gqsnrZv /RcSCtqS0euUhor3RbnbgELUJ7OJFndvyY/HyuTNLJHP+Ot1iGn2iB+8n0SJ+XrzWj7P Ok0A== X-Forwarded-Encrypted: i=1; AFNElJ84jAalYHVFKWmq3lKaT7CMF5FUXZuDbbhguNH1JLQkHMmj1dALQOnFguqlxBWbxO61OsevHDvR7hmGrR4=@vger.kernel.org X-Gm-Message-State: AOJu0YwJTPyZwe0j5vqcIbLSkzL5adAjOLxjAgz0Wql4K5QguLmh76Ko Dzw9X+Szp7dYcI4LK0klBDnpmauR1sTwAi6g3Sok+eYMhX050NPsA6rpD2DEjg08g9c= X-Gm-Gg: AfdE7cmAT8cRw7WgomEIdDFyzEUjjHAwGubWsK+Sy1FTyLY71rkMuEyO1btj25s2afZ ZCiFrXQdrrtp27iwilRlRO+aB1XoQt6MyF0DdYXVxKAj+GQxbvzDR96WGgQoYUcVg2sR5tIO4mK 8wrG/RlywTy0OECcDIFqcUnQio6taaUGiRnzcFWnXtbslImCuDTr2zkH73IB2GsyyIVxrBk7o8x 1ajKFpGgjGx1nfUyA9GnG5QaSSdtwtuNBpFQCNaUJ17doLUoExUXRNLLzBNNVS6ez031xpRU0cF 1l0apRlIWy8OEhjOMYpBOv3E6CWvmp8mLuiS/XIJbDKZPlBJhVsMyOkQ38M+PdKsplx7A+bI4Y4 764tmBG5Fkr+CkrSkIynUSpy8mAkTbb6L7uLG7CZ/byASrvaPfsCBMUefEAsJHHK/S7VrXCqtmh rQgYnsnsqqQks= X-Received: by 2002:a05:6820:2007:b0:6a1:189a:daf1 with SMTP id 006d021491bc7-6a36d85f68amr6255352eaf.4.1783609466197; Thu, 09 Jul 2026 08:04:26 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92e90cbd6c9sm1674520885a.33.2026.07.09.08.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 08:04:25 -0700 (PDT) Date: Thu, 9 Jul 2026 11:04:23 -0400 From: Johannes Weiner To: Xueyuan Chen Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Barry Song , Nanzhe Zhao , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , David Hildenbrand , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu Subject: Re: [RFC PATCH v2 2/3] mm: distinguish large folio swap allocation failures Message-ID: References: <20260709145124.764807-1-xueyuan.chen21@gmail.com> <20260709145124.764807-3-xueyuan.chen21@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: On Thu, Jul 09, 2026 at 11:01:12AM -0400, Johannes Weiner wrote: > On Thu, Jul 09, 2026 at 10:51:23PM +0800, Xueyuan Chen wrote: > > @@ -5550,10 +5558,7 @@ long mem_cgroup_get_nr_swap_pages(struct mem_cgroup *memcg) > > > > if (mem_cgroup_disabled() || do_memsw_account()) > > return nr_swap_pages; > > - for (; !mem_cgroup_is_root(memcg); memcg = parent_mem_cgroup(memcg)) > > - nr_swap_pages = min_t(long, nr_swap_pages, > > - READ_ONCE(memcg->swap.max) - > > - page_counter_read(&memcg->swap)); > > + nr_swap_pages = min(nr_swap_pages, page_counter_margin(&memcg->swap)); > > This hunk is unrelated to this patch. Don't mix refactor work with new > functionality. Make the previous patch a pure refactor job (where you > add page_counter_margin() and use it here ^), like I had proposed. I also liked my version of mem_cgroup_get_nr_swap_pages() a bit better. Please just use my patch, keep the From: and you can add Signed-off-by: Johannes Weiner