Re: [PATCH v4 01/20] list: introduce LIST_HEAD_GUARDED
From: Christoph Hellwig
Date: Wed Jul 22 2026 - 08:20:17 EST
On Mon, Jul 13, 2026 at 05:24:02PM +0530, Nilay Shroff wrote:
> Introduce LIST_HEAD_GUARDED(name, lock) to define a struct list_head
> annotated with __guarded_by(lock). This provides a convenient shorthand
> for defining lock-protected list heads and allows compiler context
> analysis to validate accesses to the list against the associated lock.
>
> The new helper also reduces boilerplate and improves consistency across
> callers that annotate struct list_head objects with __guarded_by().
>
> This is a preparatory change for subsequent patches that annotate
> LIST_HEAD() instances with their protecting lock.
>
> Suggested-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>
Looks good:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>