From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE46308F05 for ; Fri, 28 Nov 2025 11:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764327978; cv=none; b=dA+w7j9k3R8y2M1W3cPZhLRvnd/yoL38/drwzxTcpbX/eLoZXwSlBhKvXZdNqzjitqhrU/ZDY6Z8l6pm7BOO7uiduNJBxpaWaa32KxfvnY6hbce4uu+fi3MejTLD1U0j9J1xs8ymwIcPLs66vkSXGEF1O1BhfP23mkbon8BzF68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764327978; c=relaxed/simple; bh=bnGH5YqaHzHdBMv1tt+JBBOupxeg96Hc9ZEdYLVi+mg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iZiaURWcs9klie4LsMoHeHK5ALvt/sG4+4Xv2jYyzmLOHsuvGbIlfB2WcF5qIRHbTRltBQi81BbvUbvMuDPPpMsVW5FwpAUT1ZMPgrR8XQrpOtVpatPoeUGvUqbMMs1Z53Id9RkGUKaElAUVBzEcRAGGwZfLUp5twhjeI9FYWK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aQ4tY4xS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aQ4tY4xS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DB04C4CEF1; Fri, 28 Nov 2025 11:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764327977; bh=bnGH5YqaHzHdBMv1tt+JBBOupxeg96Hc9ZEdYLVi+mg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aQ4tY4xSxQDg408u1gftenqcBUao8Du9Q6/Eb7+LbO1+3Tu6Uak0jrSPGEFkDmhaf WO0c8tiCkGSuoMIaHTCIS89NwFrxhJmeqtcCUQdJGFQF7DYCP4tV87JQ2oGChfxRbJ x4JDFrcxDk4nKq714W2DIvi2RK2c0mBnGwTAVklf9H4OIWaDh+a7Lg0nDRNs1qlzWE Qk+U9lKVZ5aiBWmXhp2A8HfkaEbiOW8lVb4boVHDPnAEbcovuUS7LTYHY/1iTd8Vud FiB1n0yLEu0FZouLSuiJD0EmdTlqyc55O4jpSoBWw+D72bt1SZmVg1ijPyxNWD6dW8 LLm09t4bVV7+Q== Message-ID: <9cb0a602-69ca-400f-890c-e9dd5b44f53b@kernel.org> Date: Fri, 28 Nov 2025 12:06:14 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hugetlb: Add guard support To: Fushuai Wang , muchun.song@linux.dev, osalvador@suse.de Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, wangfushuai@baidu.com References: <20251128110241.78580-1-fushuai.wang@linux.dev> From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: <20251128110241.78580-1-fushuai.wang@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/28/25 12:02, Fushuai Wang wrote: > Introduce guard support to simplify the usage of the > hugetlb_vma_{lock,unlock}_{read,write}. > > Signed-off-by: Fushuai Wang > --- > include/linux/hugetlb.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 8e63e46b8e1f..f97cb2f123a3 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > > struct ctl_table; > struct user_struct; > @@ -468,6 +469,13 @@ static inline void hugetlb_split(struct vm_area_struct *vma, unsigned long addr) > > #endif /* !CONFIG_HUGETLB_PAGE */ > > +DEFINE_GUARD(hugetlb_vma_read, struct vm_area_struct *, > + hugetlb_vma_lock_read(_T), hugetlb_vma_unlock_read(_T)) > + > +DEFINE_GUARD(hugetlb_vma_write, struct vm_area_struct *, > + hugetlb_vma_lock_write(_T), hugetlb_vma_unlock_write(_T)) > +DEFINE_GUARD_COND(hugetlb_vma_write, _try, hugetlb_vma_trylock_write(_T)) Do I understand correctly that the code you are introducing does not have any users? -- Cheers David