lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAsGZS5tzf5-aciK2kCJCHn4oDTSAvN+=FQWzkH_3PzVm5m-iA@mail.gmail.com>
Date:	Wed, 16 May 2012 15:54:06 -0400
From:	chetan loke <loke.chetan@...il.com>
To:	Matthew Wilcox <willy@...ux.intel.com>
Cc:	Tim Chen <tim.c.chen@...ux.intel.com>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	linux-scsi@...r.kernel.org,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: SCSI RAM driver ported to 3.3 kernel for file system and I/O testing

On Wed, May 16, 2012 at 3:43 PM, Matthew Wilcox <willy@...ux.intel.com> wrote:
> On Wed, May 16, 2012 at 03:37:56PM -0400, chetan loke wrote:
>> On Wed, May 16, 2012 at 3:35 PM, Matthew Wilcox <willy@...ux.intel.com> wrote:
>> > On Wed, May 16, 2012 at 03:31:55PM -0400, chetan loke wrote:
>> >> > +               if (list_empty(&ram_device->commands))
>> >> > +                       wake_up_process(ram_device->thread);
>> >>
>> >> Didn't look in detail but if the queue is empty then why would you
>> >> want to wake up the kthread? What if you just wake_up after
>> >> list_add_tail below?
>> >
>> > If the list is non-empty, then the kthread has already been woken up
>> > and doesn't need to be woken again.
>>
>> Sorry, not able to follow. wait_even_interruptible will put kthread to
>> sleep. So how will it be already awake?
>
> Consider the following:
>
> CPU 0                   CPU 1
> ->queuecommand
> lock
> wakes kthread
> queues command 1
> unlock
>
> ->queuecommand
> lock
>                        kthread wakes
>                        lock
> queues command 2
> unlock
>                        dequeues command 1
>                        dequeues command 2
>                        unlock
>
>
> See?  No need to wake the kthread *if there's already something on the
> queue*, because you know it was already woken by whoever put the first
> command on the queue.

I thought that 'scsi_ram_device_thread' has a
'wait_event_interruptible' call if it sees that the list is empty. I
don't see that call that's why the confusion. Either queuecmd or
kthread will get the lock and so why keep the kthread spinning in that
while loop if there's nothing to do?
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ