Received: by 10.192.165.148 with SMTP id m20csp2272524imm; Thu, 26 Apr 2018 08:23:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4927PfpGahnE4qlwxExsw/7KMFNM2MS8B7VMR8fXzgTejsJsWMDS36OOfbNs8xw5Hbvr7hO X-Received: by 10.99.45.2 with SMTP id t2mr27725741pgt.356.1524756207863; Thu, 26 Apr 2018 08:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524756207; cv=none; d=google.com; s=arc-20160816; b=hQDkWtgK1u2BgZoXYcvaEvnqashC+9pEXrYddIczB+mJ3dskEcHIBh5ItSCfdFE9Sn bNYwNxyDIHVKCa3d1V9dHw5wJMBlPo+jMe0yN642TAuOS7YvPP082kxdk0+3hfh2aUKA rxD2yCzvsM+9TajqzevnX9W52ulG4BEalXrjFlQEkJy9F8AXUWcKU2cvZ1tI88TrmadF P0jmIa92sT1ye7GzGGKQfMHi7pJcTgD1ve+h3J8JLjC88AVkHpG4CdeH7H9DprsHiK+v SFiNPfZ5yPLxfORnaPaeVc3pypeU66B2yMAdYqSGImOMbVf06uN25TNSsrb3xVx3NN1A oX2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=/FIjCntC2e2hiRTlp4V6+S4qpf3pMPSEGXGs4PQFusQ=; b=lxe53rqFx5y2dDB+4NeDwJqdBRlon+eTg06I6RxDGsy8e6oWuLD3cnomy59iWFaH1U n+l3ydj8HD5/x0CnHFBVaNq26fHL8Xa1+8u/8PUwmUVV+wwjvwR5KRJCts2OP4KG07Fs tn7TT3t/AnY7qaeCy1/gCTmdnfB/gqAvSkD7ROOF7L/C1NPhZYkgB5i8TGH5lkcssaH2 DQXDktYifC1njV5+duSlRIj9LvG/6OQywx7wEltBNJXX1IqPb6aZTqpUho1Plyo4Nn9r Ls2rEBjzZo/HTRcRmtZHKISwYqLt5C9OtbiboxGJGGGiQhuwKW+ki0rO9fsyAmsHhqtq g37w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jpNC/WsA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f188si18364433pfc.316.2018.04.26.08.23.13; Thu, 26 Apr 2018 08:23:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jpNC/WsA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756699AbeDZPVt (ORCPT + 99 others); Thu, 26 Apr 2018 11:21:49 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51350 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756434AbeDZPVo (ORCPT ); Thu, 26 Apr 2018 11:21:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/FIjCntC2e2hiRTlp4V6+S4qpf3pMPSEGXGs4PQFusQ=; b=jpNC/WsAFRVDcHwyQcQ3NoVTP b2piEOqhkhH8+O9KZjKeUndthfOh56qsNGQGYZ79XlK1Q3L2tCk9fu0DtHH28BCXgy52LqhzGx/Jg azbMWaX8495Z5zvFRALOIarqjIpxwm27vxlPIiGYD47l5bUUVl8y3cJZHQsmlmk+OlV+74rbhF/7u SpYE55eiis27x+oF+bmxePbqn2CVQglOLiE/PnuFPr3A/cQEOj7EWlFBo+WyIxgFGfuO22r1hj4Cx d0eodZPTAeeZP9s9nb2cNc4ouxca2uzTiFroZ+X+/lEwKXpPu4Yj+ij7RXJbZ/eqdK1hYfBnx0JEv 6g3R2T6oQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBihc-0001HL-V8; Thu, 26 Apr 2018 15:20:57 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 426F9203BFAF5; Thu, 26 Apr 2018 17:20:53 +0200 (CEST) Date: Thu, 26 Apr 2018 17:20:53 +0200 From: Peter Zijlstra To: Kirill Tkhai Cc: Andrea Parri , akpm@linux-foundation.org, oleg@redhat.com, viro@zeniv.linux.org.uk, mingo@kernel.org, paulmck@linux.vnet.ibm.com, keescook@chromium.org, riel@redhat.com, mhocko@suse.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, marcos.souza.org@gmail.com, hoeun.ryu@gmail.com, pasha.tatashin@oracle.com, gs051095@gmail.com, ebiederm@xmission.com, dhowells@redhat.com, rppt@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, Alan Stern , Will Deacon , Boqun Feng Subject: Re: [PATCH 4/4] exit: Lockless iteration over task list in mm_update_next_owner() Message-ID: <20180426152053.GC4082@hirez.programming.kicks-ass.net> References: <152473763015.29458.1131542311542381803.stgit@localhost.localdomain> <152474046779.29458.5294808258041953930.stgit@localhost.localdomain> <20180426123542.GA819@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 04:52:39PM +0300, Kirill Tkhai wrote: > >> > >> 1)for_each_process(g) copy_process() > >> p->mm = mm > >> smp_rmb(); smp_wmb() implied by alloc_pid() > >> if (g->flags & PF_KTHREAD) list_add_tail_rcu(&p->tasks, &init_task.tasks) > >> > >> 2)for_each_thread(g, c) copy_process() > >> p->mm = mm > >> smp_rmb(); smp_wmb() implied by alloc_pid() > >> tmp = READ_ONCE(c->mm) list_add_tail_rcu(&p->thread_node, ...) For these two; what's the purpose of the smp_rmb()? which loads are ordered?