Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757812AbZAWMgo (ORCPT ); Fri, 23 Jan 2009 07:36:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754766AbZAWMgg (ORCPT ); Fri, 23 Jan 2009 07:36:36 -0500 Received: from fg-out-1718.google.com ([72.14.220.152]:39933 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754616AbZAWMgf (ORCPT ); Fri, 23 Jan 2009 07:36:35 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IXH2dGKDOUFFDUZZRyt9t/m7wf3LTX8RySutXdrL8hCo9/T1GoY9UMEGLS5xGUvMDt pb/bBMo2UqbS+Zu/Cn9c5oSBS5rL8J2hRexEEBX8rrYQ7uWEIBs1pIBraPInlCWDRI5g 7rj0dQ01cA62cfFgmBG1XqZv0MHENNMm3k9zc= MIME-Version: 1.0 In-Reply-To: <20090123110500.GA12684@redhat.com> References: <20090117215110.GA3300@redhat.com> <20090118023211.GA14539@redhat.com> <20090120203131.GA20985@cmpxchg.org> <20090121143602.GA16584@redhat.com> <20090121213813.GB23270@cmpxchg.org> <20090122202550.GA5726@redhat.com> <20090123004702.GA18362@redhat.com> <20090123110500.GA12684@redhat.com> Date: Fri, 23 Jan 2009 13:36:33 +0100 Message-ID: Subject: Re: [RFC v4] wait: prevent waiter starvation in __wait_on_bit_lock From: Dmitry Adamushko To: Oleg Nesterov Cc: Johannes Weiner , Chris Mason , Peter Zijlstra , Matthew Wilcox , Chuck Lever , Nick Piggin , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1419 Lines: 52 2009/1/23 Oleg Nesterov : > On 01/23, Dmitry Adamushko wrote: >> >> 2009/1/23 Oleg Nesterov : >> > On 01/23, Dmitry Adamushko wrote: >> >> >> >> In short, wq->lock is a sync. mechanism in this case. The scheme is as follows: >> >> >> >> our side: >> >> >> >> [ finish_wait() ] >> >> >> >> lock(wq->lock); >> > >> > But we can skip lock(wq->lock), afaics. >> > >> > Without rmb(), test_bit() can be re-ordered with list_empty_careful() >> > in finish_wait() and even with __set_task_state(TASK_RUNNING). >> >> But taking into account the constraints of this special case, namely >> (1), we can't skip lock(wq->lock). >> >> (1) "the next contender is us" >> >> In this particular situation, we are only interested in the case when >> we were woken up by __wake_up_bit(). > > Yes, > >> that means we are _on_ the 'wq' list when we do finish_wait() -> we do >> take the 'wq->lock'. > > Hmm. No? > > We are doing exclusive wait, and we use autoremove_wake_function(). > If we were woken, we are removed from ->task_list. Argh, right, somehow I've made wrong assumptions on the wake-up part :-/ > > Oleg. > -- Best regards, Dmitry Adamushko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/