From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796158468; b=D7lAZLBHOBRFRRAQbZlcAuqAZXN5PbhmZH10sgOlzAz6gR1SbdXDuZkqfcAttPgleoOf RaFeY7S20owItSymkfal3+F1xId1obde5Np4hmDodLgCRSqVXYVKoX4bHeV0IjYmMtKgd qFTkDVjC8971iqCjSgGjFP9VeVE3wTDQPpdAyDmmCIgYOnlKQUss5nT3f8rJsKQGTif59 4Fz7z2/WYaWlMcfDwS6I2Jd5wa3rTx4Vqy7wsWYbchhV0f2WrtkT6uH1BhU+loIa4FE1c gqsUMMWfYFrZaomJUvetMqn8C+kHqI1iraCCRgUveDcxPqcNdfD5TSBnjtAf02lYfnA== 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=hYFrUE2hTS/m/arWY4sR4twYEbaHgA+uincwLA2C2pTd0ZgAgWzEUT3o9sfHfcpxGL1F XmnV8eQNNEYOA8KKpy0pz2uCvwb1+0FRKVdwPr2W9HOVaqfGv+4D+cjH/wj+3npDjYNJl 0PovMLQiOUkIOws0fhQA2hc5EWIyLYHTJLwUi+4gpQWPTDz7pY049P1HrLiaB5V43COs+ NPy9E4OY+YnBib758yAmCEacrtQlWYNLpciFWCGXfKfxWiqJ+FwrTx40fsdLVOvRLZ488 4aKh7gYnMf1l0DhelbVgzy54QzsGjccKPll9mfWuW+9K7Pr0diYbj6+Ak9DCmvfWgbQ== 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.44 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 833F4606A320 for ; Tue, 1 Dec 2026 20:54:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 833F4606A320 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-f44.google.com with SMTP id 5b1f17b1804b1-4a2d6d01ecbso65148425e9.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=KzgTl9J5JdmzKCarowsaKIkKl3Engm0K7u/LG2MSttsu3VZjRC4HePePD7rdnC1+PU r92LRRqXIMQvGfEs80ZdvYRQ4Gm9x6Ef5rWFYbXHIXkggy/MZSpCn3yOxmWQs4L4uy2K 0WGjC8otI+0ofvA+1ydmRJ9uOah41HG/9grGFSRGL9cF2hDHYLd4FovHJHHqgl0mQNgg Ve5hHraEGWCTiSjvEuWbAtHFTj9SoE8DoK2L4LHdaaQ8fxtYKshBkIgIlWYIbq+52uq/ UjspjX7Ma8qJxnB0mpCAU9wuyZzf8+QFP+zKiuRYC/hxhgULVQAFGUzR8WRUyrRS/iGs K0Aw== X-Forwarded-Encrypted: i=1; AL+hErHP8Ty9hrUJhG29mvlPIA7pAE4NJVs1RG3y20dB2dhRcdXZnPUqiDoBIJGSiJH9r74+AMcFrgwwjjY/WRE=@vger.kernel.org X-Gm-Message-State: APuU4Z8TMR2pkwzRQYCozbgfFX8qRBfFX+Lum2eBFoPoBtDUAyPpb76X /p3vvd/DS4MNFQOEeIYdcIzzoxVVX0180fZOUDLQjxBSOTKDhhbSyCuUrLtLLCwCfBk= X-Gm-Gg: AZFdTZdZGRY2KdtFmUNJk69etmqmZEUdEyAIRuZWbltXH/XS2eV7/D7C3ZpNeE7PmVR fCIo1dHlFffKK9Om1WBTpSdD/28dJLViOFNNVinI9JMa06I4aqjPP4kLmy85Bjg7CmneO8plAUb NsaiML2ktNJ23ndMn76y/LDKfituGikCM6sk9CeJg5PIQ0sxY+nXqERwTlRmH5aSbNhgD2yMg7j v7xGXp4h3YCdL7xma74awFEyVB8AbNcDda+phismcTn+BwN9hffDTiKiXX11zA3bPj4jkYfsl4K nFWlELF3fZyqRRHtGM7zLS6jn2qLVVqNb19Sn/oY1P1JIcgSHt6BwV01gJic8pUSDpN/dtSdAzz e9WnoU+2ug0m2befMT6sA6tjswlfLQ2OjoYRvqqkQYgccM6CX5Y8+QWMza6Z5lzEaoRN/2DlshB lewVvVDdChIVUP8+fHU659kI+GvDjZuYfKoj2brAvym45PPzdCIW8a4eJ8QTm4+zOhTQx79KwBE 9ZzWHqW2ZogZH5rtgPFmlgHRw4D5LQfqrWcRyl0Ezi5UVsUy4A2OusEl/3VkUXHB/Nvuvl7vriP +p9OFCgxR1rgGshuVIhBuN5OFLJ7lhCFoXUeZho= 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: linux-kernel@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