From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796158468; b=nIUukeWORieOIBnxq5agRxnQ41xhGu8qOSVNOgBHf5Zrwg48ZYtZ+lwWmsLEX9Gbjc68 ixvkPoW4sDR2mbkrDgPFqKOYk794UNbYOA4D6eI5OKRW/Ktvc2IJ4JsOcqfVaiYpKfBPn wZ4svOXw/cOjm9fO3vnoZzEHRR4FIzajtvpYbxQXYs95sCYvyrSDsdj77aGzJOn78B+Tm Xpjy19vke8bcgorqrtJ2k9yNsXE/rlcWp9I23S9pcV6+F6Tl1dQeLEAGWcKnGYWYZzwvB m1sWqamWSu9dl8pJy0KXRAoD0XV5E0rL3J1aSfn2BxgpzkLp+NpiKgZ45d8F9M9yQjg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796158468; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=1ufavMMA0okZ7t8gZi2U4qO/NpKO2PyQ0oW+Bm8kT7A=; b=c00FPrKYsp8QbQml1sqHYhHRu84T3qPJTYGhpQQn5EjMTC6ncAGu9/uo28yN1tY9UFKQ sYiB8SLywlWbRYRR+AXcQX3fSEGEixFfCmk+Pq6t1k6wbAoinJuqTjcvYe5Pj0M60+cd/ cOGeb4yYsGDcYMqEtsAu7kLfwmHajJf+phgwhyevrgoJ3eWox9zGFL4i5bHYXOcpLUb2D 7C/sGAKDZXbJflJYvAR+ywc5/3tJF9PWiUKOIa+y6g8io84DvvfYkZ6IwIWhe7DctVZ1q yOEdA9AH8cNqpnGf3ww4jXYauh029F9Vqi9XbXi9ZLQGQpmZ0noBt37cmKoXHt1kMug== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=cVfzlN+H; arc=none smtp.remote-ip=209.85.128.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A6A2606A31A for ; Tue, 1 Dec 2026 20:54:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A6A2606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=cVfzlN+H Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4a2d6d01ecbso65148415e9.0 for ; Tue, 01 Dec 2026 12:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796158466; x=1796763266; 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=1ufavMMA0okZ7t8gZi2U4qO/NpKO2PyQ0oW+Bm8kT7A=; b=cVfzlN+HlA9xATJl9qBauOSXr7K4XlevKMMMdlFlQG8kUvVAS20qDON50Itn5Aicx0 lpOiqF7+WFI3VklZnPA7uSMKs1QGx6sLP4cVr4yk5aSO5ah7foSWxwYBQElG/N3xk/Bh N58JK71oXdQuRTxsgKfymg5KMutkwFyXf4qexewhXHChQsZub11aQ+MpDO9NuD2b4e2b Uu8nhmazql6LkmMfM1ja/0fNapwjh/SKwH4JPYN8anDQj1f/D89N0YySC9iV2ZJZPphO xegK+cw/K6Uwhi11SfBeafhG9my1gig9AloBpPsG0nS89De5zFEK8Igu1WJHs+TuNxbm k+rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796158466; x=1796763266; 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=1ufavMMA0okZ7t8gZi2U4qO/NpKO2PyQ0oW+Bm8kT7A=; b=LGYV+gvWSLH2hNmVQnE3pSS3uzs641b5CiSLrKjEZwGqvVpRs+uX93z+XxoQJyiKuA ylv/ZuaHmZwR7KpeWUGa6BdJ7Uyw2+4d2jf/0a03l4aLr0jMaYSVbi9ha7eVV+SBtbIe P9dMLSSyrKxAmIkO+T2Feej9GsUpQlMob8rBMladQHXuI4HEequnCH/z99uafgc9+abx pbuVh6WPajchmPlA2DpYFG1JxTBcpxbGycq6O/KA09BFdKmJXtyODCkKn7jkTLqaRvme fcpF1+Yt0FEK5WHIxGznKUbC83BrWVZ8n3dMWyFFLji8Mam4bx0Kj+PmLHAHZYw7NPjU iKXA== X-Forwarded-Encrypted: i=1; AL+hErGhim6Dk/LQfxd2fMsZUtUeVnblkNdAzwg0GfJe81TDFcy4HDeorKt+SZ5fGhB4MJDYh1tWEI8=@vger.kernel.org X-Gm-Message-State: APuU4Z/BKdUz0i3ESfNlLOYBJjmtnGvVkj78AsQeBysfITZG1YevHlWH nurP5h3on1MkgfyZ043CTgaoBYTrjlUorqYKF4l/qHHaTvlykNTVSheY7X7vGOVNL4MN8Eice+r hm8amcnU= X-Gm-Gg: AZFdTZeH52Ih1eledPz28TAbte0AOwz3IV+E+o8j8AT5N+0+FSBB1cb74v0NktKmBal WJOZfh7zb/ENAkhMIKsV3XAXIrqI4k/2EGMXibp2UPrEvX6KQeLsQE3GQzYTpFfpmYB8fd4dfK+ UI6eNWXByt8Zt2DyGilF8aFsn63ws9t2J4mAB0EUZYIFJj9Pw/DcW6gIp+TYsmKZCpfvmyv9a/Z snjv73lZwVla/0z6j+3vUUcbWc/UL056lF8aL/IcPK1hYllKZZcQfquodQX+Hbh0Oa3XV6u9SD6 yJejK06VTL2fNFjCnBjqRLnmJ9oNaoD5iBzPsVFdad3CUyB66TV03/Mi3WBWjwYsdA6laPv6sLZ IQq1sqFFJEJg+FzUNIIGCzhVqMLIfWvDFkwiCJJQOElqTwThde5nYgFhMs4KGEZFK3d6F+vK7Bq uEzup9dHYGvS9cnSJLSQgmpuZI+jfoAghTu1ou7BAUYHDntVLpwMc41pkbtSuRvO985kKxBk8mp su0Jm82gjKivzf5ueXyPINL5maSaR+LZ2CrpDxrXY6DEQnNWBIzUuZ0QOrDR/kdX8pddLHxl2hQ l/gPJfXdfq96Alcf/voA3CHiwAUM3xbImlDecg0= X-Received: by 2002:a05:600c:8888:b0:4bb:aa4f:c022 with SMTP id 5b1f17b1804b1-4bbaa4fc136mr323076735e9.2.1796158465941; Tue, 01 Dec 2026 12:54:25 -0800 (PST) Received: from localhost (109-81-21-11.rct.o2.cz. [109.81.21.11]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8960068fsm420368485e9.4.2026.12.01.12.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 12:54:25 -0800 (PST) Date: Tue, 1 Dec 2026 21:54:24 +0100 From: Michal Hocko To: Andrew Morton Cc: "David Hildenbrand (Arm)" , Qi Zheng , muchun.song@linux.dev, osalvador@suse.de, azpijr@gmail.com, lance.yang@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Qi Zheng , stable@vger.kernel.org Subject: Re: [PATCH v2 2/4] mm: gup: allow long-term pins of CMA-allocated HugeTLB folios Message-ID: References: <818fb0b4bbb234e4a2bd0552d61634f1a8431616.1793850539.git.zhengqi.arch@bytedance.com> <3eb941b6-6cca-435b-9ff9-ad5aa044588c@kernel.org> <20261201122831.7ea6961660bd88cef8994fc6@linux-foundation.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201122831.7ea6961660bd88cef8994fc6@linux-foundation.org> On Tue 01-12-26 12:28:31, Andrew Morton wrote: > On Tue, 1 Dec 2026 11:50:01 +0100 "David Hildenbrand (Arm)" wrote: > > > On 12/1/26 11:38, Michal Hocko wrote: > > > On Tue 01-12-26 10:26:03, David Hildenbrand wrote: > > >> On 12/1/26 10:12, Michal Hocko wrote: > > >>> > > >>> Sorry to chime in this late but I just learned about this change > > >>> recently. I have to say I am quite surprised that long term pins > > >>> failed on their own cmas. Is there any actual usecase to require those > > >>> to work out there? > > >>> > > >>> I have no objections to the patch but I want to learn about why nobody > > >>> cared until just now. > > >> > > >> I previously had reports from people using hugetlb_cma for backing VMs and just > > >> wanting to use vfio for device-passthrough. > > > > > > OK, so there is an explicit request behind that. So probably good to > > > have that mentioned in the changelog so that we have that for future > > > reference. > > > > I remember a discussion at LPC about that, where people also raised the demand > > for PMD allocations from hugetlb areas [2], which apparently in combination > > makes that easier to hit for some workloads. > > > > Yes, we should highlight that in the commit message. > > I did this to the changelog: > > --- a/txt/mm-gup-allow-long-term-pins-of-cma-allocated-hugetlb-folios.txt > +++ b/txt/mm-gup-allow-long-term-pins-of-cma-allocated-hugetlb-folios.txt > @@ -12,6 +12,10 @@ through HPG_cma. Allow them to be pinned even in ZONE_MOVABLE, since > memory blocks overlapping boot-time CMA areas cannot be offlined. > Ordinary movable allocations that borrow CMA memory remain unpinnable. > > +One use case is VMs backed by hugetlb_cma whose users want VFIO device > +passthrough. VFIO needs long-term pins of guest memory; currently those > +pins can fail or unnecessarily migrate the HugeTLB folios out of CMA. > + Thanks Andrew! > Link: https://patch.msgid.link/295af6601ce79f2c2b3dc4352a3279f0e6ac513e.1794907279.git.zhengqi.arch@bytedance.com > Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") > Signed-off-by: Qi Zheng > > > > [2] https://lkml.kernel.org/r/cover.1792651104.git.zhengqi.arch@bytedance.com -- Michal Hocko SUSE Labs