From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (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 900E257D23E for ; Wed, 23 Sep 2026 22:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790201367; cv=none; b=Sxotwcg2f/r/RzIZWZQ2odVAlhV/AvhmLwGLdcQjOuvbwD9oeai+yOHGjY6g8JysIns2sZH54YHL/Bqi2fA3KJlHlJUV0swml1LC5Mk1NuR8yOKp2OHHSoC7J1awqyMlgkm4S/jr2QPfKz8JwpsG1TFjavtlAy65EPdqfePx3Vw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790201367; c=relaxed/simple; bh=b0TAtr57yWE+QSO16pjO+nrOxPN+Pz6dGmFJGAl5jPA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RGBQp+QyUq72qPxXYqzk3Hq67RCXoBhIu9OZlCS6mO/DvPM7ZQioWbiEZwZXweyEVF72mj0VJEXxPDJE1q4lGci+SdF9WJuTZhMrWN3F/bFrxlibyPGgJY4oHf1lU7gM1cFerZ0lRjUZSVhh1u4AQdS1qcnObkUkmy4kyXtGmWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hcM78zUf; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hcM78zUf" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd38e0e5dso17471855e9.2 for ; Wed, 23 Sep 2026 15:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790201364; x=1790806164; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0vfvvH4VnMd4dK0iJViHA204XuBKefpDpGV2LA9qE58=; b=hcM78zUf/OarTJnCAvLnhcMARyxhZZB1YqM21ZpU2+InWJXd4saJi85V3wPxwjSGpg rFa9BC0CaR/QZuuJXNzEg51AqCH9tzkPQVifIhYM+5ujMndca7+TLNmt6yWebOVBA0hd DsGTbQYoh5Op/1g4Lm2jgaishy6Rsx9fu10v+flgiTeIiFVgkN6GM9Jt12HSXFz8Owh4 mFa6w2gv6YEnhKKZJBdtVvop7pnAokHL4MCyDECDrT9ayMNzHc9eG31KC+6fiJvbPp1H g4bHyAI7/kjfaHWh3HmE3SkyzWq+rLzRmBkl9ndYIAscbRnt3tnaW1xVtJ1mDrZ/xdsB 22Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790201364; x=1790806164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=0vfvvH4VnMd4dK0iJViHA204XuBKefpDpGV2LA9qE58=; b=cp5mINEZzCWVLQgb+VieA+zTornYPmABnLLcRbCcZQAsud3evX/RejEtsCFoqojENS hkRlODB3iTlsmjYYcfuv2M0AEAhpkBw6iSevoleZa38tLt6Ayr5WZRbydqrVgRWxU0xp qsyTvWSKS8Lsbbznzg21LT0slbfr1cWsaDKbYlurMVhKkKVoa/a6Ib807PcyhhM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-Received: by 2002:a05:600c:138f:b0:49e:602a:b4ec with SMTP id 5b1f17b1804b1-49fe66d2700mr8501195e9.8.1790201363197; Wed, 23 Sep 2026 15:09:23 -0700 (PDT) Received: from localhost.localdomain (dynamic-2a02-3100-a4a2-9601-c082-2dcb-3f3b-92b8.310.pool.telefonica.de. [2a02:3100:a4a2:9601:c082:2dcb:3f3b:92b8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fdf3541aesm57899075e9.0.2026.09.23.15.09.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Sep 2026 15:09:22 -0700 (PDT) From: Karl Mehltretter To: Andrew Morton Cc: Karl Mehltretter , Ackerley Tng , Zhao Li , Jinmeng Zhou , Alex Shi , David Hildenbrand , Dongliang Mu , Hongxiang Lou , Johannes Weiner , Jonathan Corbet , Joshua Hahn , "Liam R. Howlett" , Lorenzo Stoakes , Miaohe Lin , Michal Hocko , Mike Rapoport , Muchun Song , Nhat Pham , Oscar Salvador , Peter Xu , Randy Dunlap , Roman Gushchin , Shakeel Butt , Shuah Khan , Suren Baghdasaryan , Usama Arif , Vlastimil Babka , Wupeng Ma , Yanteng Si , Naoya Horiguchi , fvdl@google.com, jthoughton@google.com, rientjes@google.com, vannapurve@google.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [PATCH v3 0/4] Fix HugeTLB subpool used_hpages tracking Date: Thu, 24 Sep 2026 00:09:12 +0200 Message-Id: <20260923220912.46905-1-kmehltretter@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20260916201307.5618114cbac4af52d98aecfa@linux-foundation.org> References: <20260916-hugetlb-subpool-always-track-used-v3-0-38aae9b5ccdd@google.com> <20260916201307.5618114cbac4af52d98aecfa@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 16 Sep 2026 20:13:07 -0700 Andrew Morton wrote: > So if downstream people (-stable maintainers, others) follow our > recommendations, some kernels will get two of these patches, other > kernel versions will get three and some lucky kernels might get all > four. Are you confident that the patches can be split apart in this > fashion and still produce a good result? Two things I noticed while testing this series on v7.3-rc3 (x86_64 QEMU, one CPU): 1. It overlaps with two fixes already queued in mm.git, so I've added their authors to Cc: - 3/4 rewrites the same out_subpool_put: block as Zhao Li's "mm/hugetlb: fix max-only subpool accounting on alloc_hugetlb_folio failure" (mm-hotfixes-unstable), and has the same Fixes: tag. - 2/4 rewrites the same out_put_pages: block as Jinmeng Zhou's "mm/hugetlb: fix subpool minimum reservation rollback" (mm-unstable). 3/4 doesn't apply to mm-hotfixes-unstable, and 2/4-4/4 don't apply to mm-unstable. If I read them right, the queued fixes only handle mounts with size=, while 2/4 and 3/4 also cover min_size mounts, so they would probably replace them. 2. On splitting: 1/4 applies cleanly on top of both queued fixes, but in my tests it made min_size-only mounts worse on its own. As far as I can tell, that's because it starts tracking used_hpages on those mounts, while the two error paths only release it after 2/4 and 3/4. HugePages_Rsvd, expected value in parentheses. Q = the two queued fixes, wrap = 18446744073709551615: rc3 +Q +1/4 +Q+1/4 +1/4..4/4 min_size=4M only: SIGBUS faults [1], no files (2) 2 2 0 0 2 min_size=8M only: failed mmap [2], umounted (0) 0 0 3 3 0 size=8M,min_size=4M: SIGBUS faults [1], no files (2) 0 0 0 0 2 size=10M,min_size=8M: failed mmap [2], umounted (0) wrap 0 wrap 0 0 With 1/4 alone, the min_size-only mount loses its reservation, and in the failed-mmap case three huge pages stay reserved after umount, presumably because the subpool is never freed. So it looks to me like 1/4 shouldn't go anywhere without 2/4 and 3/4. I haven't tested older stable trees. With all four patches applied, all the cases above give the expected values, and so does the partial-truncate case from the 1/4 changelog (Rsvd drops to 0 after the truncate instead of staying at 1). I'm happy to rerun these tests on a rebased v4. [1] https://lore.kernel.org/r/20260923065714.20781-1-kmehltretter@gmail.com/ [2] the scenario from Jinmeng's changelog: https://lore.kernel.org/20260907132055.26696-1-zhoujinmeng@bytedance.com Thanks, Karl