memory_tier_lock isn't held to call register_memory_tier() in this patch. That will cause confusion.will this help to explain this better modified mm/memory-tiers.c @@ -151,6 +151,11 @@ static void insert_memory_tier(struct memory_tier *memtier) struct list_head *ent; struct memory_tier *tmp_memtier; + if (IS_ENABLED(CONFIG_DEBUG_VM) && !mutex_is_locked(&memory_tier_lock)) { + WARN_ON_ONCE(1); + return; + }
Why not just use lockdep here instead?