Re: [PATCH 2/2] zram: Use a custom key for each zram object.

Sergey Senozhatsky <[email protected]>
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hello, sorry for the delay

On (26/07/14 16:13), Sebastian Andrzej Siewior wrote:
> Each struct zram uses the same key for its struct lockdep_map which is
> used for locking analysis.
> According to Sergey the lock chains might be different if zram1 is used
> for and zram2 is for ext4. This might lead to false dead lock reports if

    ^^ swap  (a minor nit)

> it mixes a zram1 chain with a zram2. This can be avoided if each lockmap
> gets its own unique key.c
> 
> Use a dynamic lock_class_key for the table_lock_map.
> 

[..]

>  static bool zram_meta_alloc(struct zram *zram, u64 disksize)
> @@ -1999,7 +1993,8 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
>  	if (!huge_class_size)
>  		huge_class_size = zs_huge_class_size(zram->mem_pool);
>  
> -	slot_lock_init(zram);
> +	lockdep_register_key(&zram->table_lock_key);
> +	lockdep_init_map(&zram->table_lock_map, "zram->table[index].lock", &zram->table_lock_key, 0);

So I wonder if we can give distinct name, given that it's per-device
now: "zram%d->table[index].lock" and use zram->disk->first_minor (which
is a unique device id).

If you are too busy I can just send a trivial follow up patch.
Let me know what you prefer.


Reviewed-by: Sergey Senozhatsky <[email protected]>
Tested-by: Sergey Senozhatsky <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.