Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426189 > unrolled thread

[PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram

Started byByungchul Park <byungchul.park@lge.com>
First post2016-06-20 07:20 +0200
Last post2016-06-21 03:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram Byungchul Park <byungchul.park@lge.com> - 2016-06-20 07:20 +0200
    Re: [PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-06-20 17:40 +0200
      Re: [PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram Byungchul Park <byungchul.park@lge.com> - 2016-06-21 03:10 +0200

#1426189 — [PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram

FromByungchul Park <byungchul.park@lge.com>
Date2016-06-20 07:20 +0200
Subject[PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram
Message-ID<rLZMR-42g-19@gated-at.bofh.it>
In order to use lockdep-enabled bit_spin_lock, we have to call
bit_spin_init() when a instance including the bit used as lock
creates, and bit_spin_free() when the instance including the bit
destroys.

The zram is one of bit_spin_lock users. And this patch adds
bit_spin_init() and bit_spin_free() properly to apply the lock
correctness validator to bit_spin_lock the rzam is using.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 drivers/block/zram/zram_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 370c2f7..2bc3bde 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -495,6 +495,11 @@ static void zram_meta_free(struct zram_meta *meta, u64 disksize)
 	}
 
 	zs_destroy_pool(meta->mem_pool);
+
+	for (index = 0; index < num_pages; index++) {
+		bit_spin_free(ZRAM_ACCESS, &meta->table[index].value);
+	}
+
 	vfree(meta->table);
 	kfree(meta);
 }
@@ -503,6 +508,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
 {
 	size_t num_pages;
 	struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
+	int index;
 
 	if (!meta)
 		return NULL;
@@ -520,6 +526,10 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
 		goto out_error;
 	}
 
+	for (index = 0; index < num_pages; index++) {
+		bit_spin_init(ZRAM_ACCESS, &meta->table[index].value);
+	}
+
 	return meta;
 
 out_error:
-- 
1.9.1

[toc] | [next] | [standalone]


#1426702

FromSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date2016-06-20 17:40 +0200
Message-ID<rM9sS-1zy-25@gated-at.bofh.it>
In reply to#1426189
On (06/20/16 13:55), Byungchul Park wrote:
> In order to use lockdep-enabled bit_spin_lock, we have to call
> bit_spin_init() when a instance including the bit used as lock
> creates, and bit_spin_free() when the instance including the bit
> destroys.
> 
> The zram is one of bit_spin_lock users. And this patch adds
> bit_spin_init() and bit_spin_free() properly to apply the lock
> correctness validator to bit_spin_lock the rzam is using.

Hello,

just for information

there was a proposal from -rt people to use normal spinlocks
for table's entries, rather that bitspinlock. I had a patch
some time ago, will obtain some performance data and post
RFC [may be tomorrow].

	-ss

> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  drivers/block/zram/zram_drv.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 370c2f7..2bc3bde 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -495,6 +495,11 @@ static void zram_meta_free(struct zram_meta *meta, u64 disksize)
>  	}
>  
>  	zs_destroy_pool(meta->mem_pool);
> +
> +	for (index = 0; index < num_pages; index++) {
> +		bit_spin_free(ZRAM_ACCESS, &meta->table[index].value);
> +	}
> +
>  	vfree(meta->table);
>  	kfree(meta);
>  }
> @@ -503,6 +508,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
>  {
>  	size_t num_pages;
>  	struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
> +	int index;
>  
>  	if (!meta)
>  		return NULL;
> @@ -520,6 +526,10 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
>  		goto out_error;
>  	}
>  
> +	for (index = 0; index < num_pages; index++) {
> +		bit_spin_init(ZRAM_ACCESS, &meta->table[index].value);
> +	}
> +
>  	return meta;
>  
>  out_error:
> -- 
> 1.9.1
> 

[toc] | [prev] | [next] | [standalone]


#1427173

FromByungchul Park <byungchul.park@lge.com>
Date2016-06-21 03:10 +0200
Message-ID<rMimt-7ky-5@gated-at.bofh.it>
In reply to#1426702
On Tue, Jun 21, 2016 at 12:36:19AM +0900, Sergey Senozhatsky wrote:
> 
> Hello,
> 
> just for information

Thank you for informing it.

> 
> there was a proposal from -rt people to use normal spinlocks
> for table's entries, rather that bitspinlock. I had a patch
> some time ago, will obtain some performance data and post
> RFC [may be tomorrow].
> 
> 	-ss
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web