Re: [PATCH v6 01/13] mm/demotion: Add support for explicit memory tiers

Davidlohr Bueso
2022-06-14T15:28:17Z

>> 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?