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: <20120528102614.GC15202@dhcp-172-17-108-109.mtv.corp.google.com>
Date:	Mon, 28 May 2012 19:26:14 +0900
From:	Tejun Heo <tj@...nel.org>
To:	Asias He <asias@...hat.com>
Cc:	Jens Axboe <axboe@...nel.dk>, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: Avoid missed wakeup in request waitqueue

On Mon, May 28, 2012 at 12:19:03PM +0800, Asias He wrote:
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 1f61b74..1a45877 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -359,9 +359,10 @@ EXPORT_SYMBOL(blk_put_queue);
>   */
>  void blk_drain_queue(struct request_queue *q, bool drain_all)
>  {
> +	int i;
> +
>  	while (true) {
>  		bool drain = false;
> -		int i;
>  
>  		spin_lock_irq(q->queue_lock);
>  
> @@ -400,6 +401,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
>  			break;
>  		msleep(10);
>  	}
> +
> +	/* Wake up threads which are sleeping on get_request() */
> +	spin_lock_irq(q->queue_lock);
> +	for (i = 0; i < ARRAY_SIZE(q->rq.wait); i++) {
> +		if (waitqueue_active(&q->rq.wait[i]))
> +			wake_up_all(&q->rq.wait[i]);
> +	}
> +	spin_unlock_irq(q->queue_lock);

I don't think we need waitqueue_active() optimization here.  Let's
just do,

	/* please explain why this is necessary */
	for (i = 0; i < ARRAY_SIZE(q->rq.wait); i++)
		wake_up_all(&q->rq.wait[i]);

Thanks.

-- 
tejun
--
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