The all_blkcgs list is documented as being protected by blkcg_pol_mutex. Replace that comment with LIST_HEAD_GUARDED() so that Clang's context analysis can check that every access to the list happens while blkcg_pol_mutex is held. Do not annotate blkcg_policy[] since it is read without holding blkcg_pol_mutex from several hot paths, e.g. blkg allocation and freeing. Signed-off-by: Bart Van Assche --- block/blk-cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 19e21e057a4b..5fe41367d5fb 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -58,7 +58,7 @@ atomic_t blkcg_nr_congested __read_mostly = ATOMIC_INIT(0); static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; -static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */ +static LIST_HEAD_GUARDED(all_blkcgs, blkcg_pol_mutex); bool blkcg_debug_stats = false;