Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761135AbZFXTpb (ORCPT ); Wed, 24 Jun 2009 15:45:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751460AbZFXTpS (ORCPT ); Wed, 24 Jun 2009 15:45:18 -0400 Received: from mx2.redhat.com ([66.187.237.31]:58504 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbZFXTpR (ORCPT ); Wed, 24 Jun 2009 15:45:17 -0400 Date: Wed, 24 Jun 2009 18:30:24 +0200 From: Oleg Nesterov To: Jiri Olsa Cc: Eric Dumazet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, fbl@redhat.com, nhorman@redhat.com, davem@redhat.com Subject: Re: [RFC] tcp: race in receive part Message-ID: <20090624163024.GA29337@redhat.com> References: <20090618102727.GC3782@jolsa.lab.eng.brq.redhat.com> <4A3A49F2.6060705@gmail.com> <20090623091257.GA4850@jolsa.lab.eng.brq.redhat.com> <4A40AF2A.3050509@gmail.com> <20090624102038.GA5409@jolsa.lab.eng.brq.redhat.com> <4A42082D.9060402@gmail.com> <20090624162112.GB5409@jolsa.lab.eng.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090624162112.GB5409@jolsa.lab.eng.brq.redhat.com> 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: 1143 Lines: 36 On 06/24, Jiri Olsa wrote: > > +/* The read_lock() on x86 is a full memory barrier. */ > +#define smp_mb__after_read_lock() barrier() Just curious, why do we need barrier() ? I must admit, personally I dislike _read_lock part. Because I think we need a "more generic" smp_mb__{before,after}_lock() or whatever which work for spin_lock/read_lock/write_lock. In that case it can have more users. Btw, in fs/select.c too, see __pollwake(). And surprise, > --- a/fs/select.c > +++ b/fs/select.c > @@ -219,6 +219,10 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, > init_waitqueue_func_entry(&entry->wait, pollwake); > entry->wait.private = pwq; > add_wait_queue(wait_address, &entry->wait); > + > + /* This memory barrier is paired with the smp_mb__after_read_lock > + * in the sk_has_sleeper. */ > + smp_mb(); This could be smp_mb__after_lock() too. 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/