[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 9 Sep 2013 18:09:42 +0300
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, Minchan Kim <minchan@...nel.org>,
Jerome Marchand <jmarchan@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] staging: zram: minimize `slot_free_lock' usage (v2)
On (09/09/13 17:52), Dan Carpenter wrote:
> On Mon, Sep 09, 2013 at 05:42:59PM +0300, Sergey Senozhatsky wrote:
> > > 3) Explain why it is safe to test zram->slot_free_rq when we are not
> > > holding the lock. I think it is unsafe. I don't want to even think
> > > about it without the numbers.
> >
> > atomic pointer test, which is either NULL or !NULL.
> >
>
> That's not how concurency works. Atomic types are complicated than
> that. Anyway, the zram maintainers don't need me to explain that to
> them so I'll let them take over from here.
>
yes, I understand that. but can't we check slot_free_rq pointer
(32 or 64 bit read) w/o locking to just decide if we must:
-- call handle_pending_slot_free()
-- take the slot_free_lock
-- check slot_free_rq again (this time under the slot_free_lock) and perform
slot_free_rq operations while it is !NULL.
-ss
> regards,
> dan carpenter
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists