From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 463B130CD81 for ; Fri, 28 Nov 2025 11:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764329012; cv=none; b=ViX+Dx7sFXDSVBFUGUt0NvUo9pBW5mXgncsvxt43FOUNl0kRdSf682fu+s1M74C1ikw1QVTu1scyj4i5mfcGr7FM8GQFma1rvOKoqJfdeeDn9wzim4zrFG2pdVVjEv/5bHf6FJma3CAiP6XbeULE0ukvfqBoLGBKZhvlXKEn6lg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764329012; c=relaxed/simple; bh=wsu0uDTW36HVQ2hTg783R/wHI1YHjnUPsc/yJYcVIMs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p5Nw+p13VA0a2bdi7sjOVM7CeY4xTc6lM8m+G2zVtYl1mRpxf00xZjO8fz1AlcNKaqExf86sAikOMOwioOmQkF3rI8xNZcKfw3hyy1kddpSfBYbO6LerUk39UhtbJfhB3a/mSMSDhgrTtWG20gqDpfFn1eU6Mqnf3I8662ctF0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WDPd+YDR; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WDPd+YDR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1764329008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t4/H51uaWVpHVj7Na1I0I3Iy+BFCyBmc2I+NPnG0fy4=; b=WDPd+YDRjTd/U1XuFNbZNN2HyyJ8X1LNUPgMkITtTMEaeu4k5Oa66twKQbzSUmJ49uOtiR /Lpul22+nJotsALHDa9qYYnKIsfbg+b2iEVB0bt4txbm+q+GyOxw/G1x3yHxVuV1KRqe0U UafMHDEADBF0HQIbN3eyT5YMPdVN4mI= From: Fushuai Wang To: david@kernel.org Cc: fushuai.wang@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, muchun.song@linux.dev, osalvador@suse.de, wangfushuai@baidu.com Subject: Re: [PATCH] hugetlb: Add guard support Date: Fri, 28 Nov 2025 19:23:07 +0800 Message-Id: <20251128112307.80237-1-fushuai.wang@linux.dev> In-Reply-To: <9cb0a602-69ca-400f-890c-e9dd5b44f53b@kernel.org> References: <9cb0a602-69ca-400f-890c-e9dd5b44f53b@kernel.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 X-Migadu-Flow: FLOW_OUT >> 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? Yes, it is not used now, but it can be used in future development to simplify the code. If there are complex hugetlb_vma locks in the current code, this can also be used later to optimize them. --- Regards, Wang.