[PATCH 1/2] staging: zram: minimize `slot_free_lock' usage (v2)

Dan Carpenter dan.carpenter at oracle.com
Mon Sep 9 12:33:29 UTC 2013


On Fri, Sep 06, 2013 at 06:12:55PM +0300, Sergey Senozhatsky wrote:
> Calling handle_pending_slot_free() for every RW operation may
> cause unneccessary slot_free_lock locking, because most likely
> process will see NULL slot_free_rq. handle_pending_slot_free()
> only when current detects that slot_free_rq is not NULL.
> 
> v2: protect handle_pending_slot_free() with zram rw_lock.
> 

zram->slot_free_lock protects zram->slot_free_rq but shouldn't the zram
rw_lock be wrapped around the whole operation like the original code
does?  I don't know the zram code, but the original looks like it makes
sense but in this one it looks like the locks are duplicative.

Is the down_read() in the original code be changed to down_write()?

regards,
dan carpenter



More information about the devel mailing list