From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756424AbbBCXZF (ORCPT ); Tue, 3 Feb 2015 18:25:05 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:38605 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755202AbbBCXY7 (ORCPT ); Tue, 3 Feb 2015 18:24:59 -0500 Message-ID: <54D158C7.6020606@kernel.dk> Date: Tue, 03 Feb 2015 16:24:55 -0700 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Zijlstra , Linus Torvalds CC: Benjamin LaHaise , linux-aio@kvack.org, Linux Kernel Subject: Re: [GIT PULL] aio: fix sleeping while TASK_INTERRUPTIBLE References: <20150201144058.GM2974@kvack.org> <20150201221458.GN2974@kvack.org> <20150202001628.GO2974@kvack.org> <20150203112733.GM26304@twins.programming.kicks-ass.net> <20150203113348.GH24151@twins.programming.kicks-ass.net> <20150203115531.GI24151@twins.programming.kicks-ass.net> In-Reply-To: <20150203115531.GI24151@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2015 04:55 AM, Peter Zijlstra wrote: > On Tue, Feb 03, 2015 at 12:33:48PM +0100, Peter Zijlstra wrote: >>> block/bsg.c- prepare_to_wait(&bd->wq_done, &wait, TASK_UNINTERRUPTIBLE); >>> block/bsg.c- spin_unlock_irq(&bd->lock); >>> block/bsg.c: io_schedule(); >>> block/bsg.c- finish_wait(&bd->wq_done, &wait); >>> >>> Which is double buggy because: >>> 1) it doesn't loop >>> 2) it sets TASK_UNINTERRUPTIBLE _after_ testing for the sleep event. >> >> OK, actually had a look at this one; it might be ok. >> >> The spinlock might fully serialize the state so no fails, and the entire >> function is called in a loop. Still seriously obtuse code. > > Jens, would something like the below work for you? Yes, from a cursory look, that seems fine to me. Though I will hold the fact that you label my code as 'seriously obtuse' against you. Some day. I can pull this in for testing for 3.20. Mind sending a properly formatted patch (signed off, commit message, all that stuff)? -- Jens Axboe