From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755451AbcFTPhx (ORCPT ); Mon, 20 Jun 2016 11:37:53 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34897 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753291AbcFTPhe (ORCPT ); Mon, 20 Jun 2016 11:37:34 -0400 Date: Tue, 21 Jun 2016 00:36:19 +0900 From: Sergey Senozhatsky To: Byungchul Park Cc: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, npiggin@suse.de, sergey.senozhatsky@gmail.com, gregkh@linuxfoundation.org, minchan@kernel.org, sergey.senozhatsky.work@gmail.com Subject: Re: [PATCH 3/5] lockdep: Apply bit_spin_lock lockdep to zram Message-ID: <20160620153619.GA649@swordfish> References: <1466398515-1005-1-git-send-email-byungchul.park@lge.com> <1466398515-1005-4-git-send-email-byungchul.park@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466398515-1005-4-git-send-email-byungchul.park@lge.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >