zram: introduce zram->tb_lock
authorMinchan Kim <minchan@kernel.org>
Thu, 30 Jan 2014 23:46:03 +0000 (15:46 -0800)
committerAlex Shi <alex.shi@linaro.org>
Mon, 11 May 2015 11:31:27 +0000 (19:31 +0800)
commit76b3c1eb150766da298e3c68074dbd1401f22a7c
tree097eff3a370b7641a43601fc9be1e885f03b16f2
parent671b5561a6c05a36da64a2b798b1b52dada37c2c
zram: introduce zram->tb_lock

Currently, the zram table is protected by zram->lock but it's rather
coarse-grained lock and it makes hard for scalibility.

Let's use own rwlock instead of depending on zram->lock.  This patch
adds new locking so obviously, it would make slow but this patch is just
prepartion for removing coarse-grained rw_semaphore(ie, zram->lock)
which is hurdle about zram scalability.

Final patch in this patchset series will remove the lock from read-path
and change rw_semaphore with mutex in write path.  With bonus, we could
drop pending slot free mess in next patch.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 92967471b67163bb1654e9b7fe99449ab70a4aaa)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
drivers/block/zram/zram_drv.c
drivers/block/zram/zram_drv.h