From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796156912; b=3373RtgKKHRoB1Jo95KEwk6FGxJzIP5/1hpNp2n0XNUlRHFpasCdr1vYV/S2Ksg6j70a 5x13UAb/lDO8LsaHLHJajrVRhG91HGDdZADFgNQhszDY1ourwh6pBmIi1eB4Hp8n+lNyH WbbkbQYm+Cd8+/y5SSlEG1oI4iXcmiECz//Ec6QRi5s0si1DYj76F90F/8rZaBGEwHsm7 k0g+dy6uNGI4gxX8biHn61xFA5d5uJ/0Tg8SsZM7qqjskFtTfhgJi4h+5/2QuS7C1Z+Dk jUD3t/b+QwsE/HOoWH1gIFT6XF6gW8NdzZ5GIO87kfK69hALOKMQSkdqDY9BmMI4h3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796156912; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-Id: In-Reply-To:References:X-Mailer:Mime-Version:Content-Type: Content-Transfer-Encoding; bh=ijt6Yns5jgrTiRgkrNJggj/Me/XslD5EJ6Bjj9MuO9o=; b=ZT9C1oL6+I0rRxYJEbVkHSF7qkQp/Z/oRf0meZ0Hl6tSY9ZMNGeDz2cNFiC4KsYnXCim kRv8+fiOFwNwTGPvuX1OLZqnVX/PwgCp+LYRnU0n/8wB+vOPXjdPzsQssW0b+tLWxmuyb 6e+uXn6jJbqETDBlXhFAHwchKdUkdJhxtmw15U6/G+T21AS7KvV/SVdWPto5jFL5EcdFO JBvAGcfFGG99D65YPn+cEuFBhfIsesnQIO7Kcqgknn6ShbXle8giFOoXAB4wRzMB1bccw mDbyf5O9+U8TPjPzYb9v9Nnwg+cXmOxc+Ahd5l5HyW+eM9FQsYYmqtORHYQE+/TiUMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=XdJcyfOU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6741D606A320; Tue, 1 Dec 2026 20:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=XdJcyfOU Received: by smtp.kernel.org (Postfix) with ESMTPSA id B23D01F00893; Tue, 1 Dec 2026 20:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796156912; bh=ijt6Yns5jgrTiRgkrNJggj/Me/XslD5EJ6Bjj9MuO9o=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=XdJcyfOUTXav8kIyIZrZ5d3BUd1BmmXwgZITLYNScWn0LHpi5a7RE37XMwLFd7fR8 VJJlwyk7ujSWUZ5eJXqXlPRkkyLVr9o1lAD+DKOMmaXH+FYZ3rKXo4UV+ZILq2PKpL QfVbNYe7vhp8SkDb23iI6WCXwDxntgadbyThggJ4= Date: Tue, 1 Dec 2026 12:28:31 -0800 From: Andrew Morton To: "David Hildenbrand (Arm)" Cc: Michal Hocko , 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: <20261201122831.7ea6961660bd88cef8994fc6@linux-foundation.org> In-Reply-To: <3eb941b6-6cca-435b-9ff9-ad5aa044588c@kernel.org> References: <818fb0b4bbb234e4a2bd0552d61634f1a8431616.1793850539.git.zhengqi.arch@bytedance.com> <3eb941b6-6cca-435b-9ff9-ad5aa044588c@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit 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. + 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