From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f65.google.com ([209.85.208.65]:46752 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbeLDX7Q (ORCPT ); Tue, 4 Dec 2018 18:59:16 -0500 Received: by mail-ed1-f65.google.com with SMTP id o10so15445316edt.13 for ; Tue, 04 Dec 2018 15:59:15 -0800 (PST) Date: Wed, 5 Dec 2018 00:59:07 +0100 From: Andrea Parri To: Roman Penyaev Cc: Linus Torvalds , Al Viro , Paul McKenney , linux-fsdevel , Linux List Kernel Mailing Subject: Re: [RFC PATCH 1/1] epoll: use rwlock in order to reduce ep_poll_callback() contention Message-ID: <20181204235907.GA5388@andrea> References: <20181203110237.14787-1-rpenyaev@suse.de> <83edf06ce9db540495b53527eca3248c@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83edf06ce9db540495b53527eca3248c@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Roman, On Tue, Dec 04, 2018 at 12:50:58PM +0100, Roman Penyaev wrote: > On 2018-12-03 18:34, Linus Torvalds wrote: > > This also ends up making the memory ordering of "xchg()" very very > > important. Yes, we've documented it as being an ordering op, but I'm > > not sure we've relied on it this directly before. > > Seems exit_mm() does exactly the same, the following chunk: > > up_read(&mm->mmap_sem); > > self.task = current; > self.next = xchg(&core_state->dumper.next, &self); > > > At least code pattern looks similar. Maybe add a comment on top of (your) xchg() to note/justify these memory ordering requirements? As Paul said: "if there are races, this would help force them to happen" (and simplify the review, this/future). Andrea