Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754515Ab3HKRbH (ORCPT ); Sun, 11 Aug 2013 13:31:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18759 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754263Ab3HKRbE (ORCPT ); Sun, 11 Aug 2013 13:31:04 -0400 Date: Sun, 11 Aug 2013 19:25:11 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: "linux-arch@vger.kernel.org" , Long Gao , Al Viro , Andrew Morton , Linux Kernel Mailing List Subject: Re: Patch for lost wakeups Message-ID: <20130811172510.GA10081@redhat.com> References: <20130808191749.GA12062@redhat.com> <20130809130457.GA27493@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1340 Lines: 33 On 08/09, Linus Torvalds wrote: > > I guess that instead of a "smp_wmb()", we could do another > "smp_mb__before_spinlock()" thing, like we already allow for other > architectures to do a weaker form of mb in case the spinlock is > already a full mb. That would allow avoiding extra synchronization. Do > a > > #ifndef smp_mb__before_spinlock > #define smp_mb__before_spinlock() smp_wmb() > #endif > > in to not force everybody to implement it. Because > a wmb+acquire should be close enough to a full mb that nobody cares > (ok, so reads could move into the critical region from outside, but by > the time anybody has called "schedule()", I can't see it mattering, so > "close enough"). Yes, this is what I tried to suggest. And of course we should turn that wmb() in try_to_wake_up() into smp_mb__before_spinlock(). I event started the patch, but we already have smp_mb__after_lock(), so it should be smp_mb__before_lock() for consistency and we need to turn it to "define" too. Or change ARCH_HAS_SMP_MB_AFTER_LOCK, or add ARCH_HAS_SMP_MB_BEFORE_LOCK. Oleg. -- 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/