Received: by 10.192.165.148 with SMTP id m20csp2272120imm; Thu, 26 Apr 2018 08:23:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vsUKpVHU+/jHJkNj+QqlyHhueFKSwLG9VWWYhU+BP/1xVK+13xQTuKDLpWvfypscFtezU X-Received: by 10.98.144.85 with SMTP id a82mr33137510pfe.14.1524756185597; Thu, 26 Apr 2018 08:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524756185; cv=none; d=google.com; s=arc-20160816; b=L3z9cIgfehTg4TIKI6ithFZBP6kRMIgE6oyofeXjOXOlSPhRAk0omAo6d9Due5PhqM mhzWhfj4E+cFuxXiABBgYRoQUpW36aSansKW+uO12wxULKpwb1h2Zy0d6BseiDminwYe uF0WXHe/WKNXfcgkiF0PbwRRsj3WQn/J1MgTQltULWTiCJTUemaKWWvdRuLePaXYPue5 nW5JnR8xhSst76OE+cSZQzOtPbZ+nqo9b6SH8bDHpY3qySK7xjqudSnpqcFYUUJ3EowS vhT/Ddv7QZEyN/7KvzmrlQaF8PaVp0AL33e4P/qesxltIPc0LRkkBAdPQrSKaGSbJnaF tr6Q== 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=SIbiLAWkEqA5urzBDDz8S9yN0b1RfA8Wz9OBPbLz6oQ=; b=LTC6gvBF0RzGbzy4MNw4a68A7eg/7wiNwXEw3WhvAnpMyOIECgfHpXlsJ44Kh0mE8x +QpbfPV4VI7mEm7XEeM2G7IMffogd8c/odtKf9UVOqYQC4G8UXT7XlSk3FhzhEWuRSI1 /xOptMA/HpdLi3c3RniVNXP3nakZ3Qwz8KOqvv3jQLJWMyhLPBJoE/mJ0MfCM+dIzDMT SHmLI2WnX9uvG/thfIfRHYW9NO1E60ynIKjLMfkLvu5IcYhb6p/YJ3FB+Hu4tk3m8rIf cqWzKCUBX84xo53hfCGcZ/q2FkPbyHxFUMzrhtAeL8TPlPDs11YwsihfczfuUS92hurr zM0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BPx2K4ZX; 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 p15si4470748pgq.478.2018.04.26.08.22.51; Thu, 26 Apr 2018 08:23:05 -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=bombadil.20170209 header.b=BPx2K4ZX; 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 S932216AbeDZPUY (ORCPT + 99 others); Thu, 26 Apr 2018 11:20:24 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34372 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932135AbeDZPUU (ORCPT ); Thu, 26 Apr 2018 11:20:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=SIbiLAWkEqA5urzBDDz8S9yN0b1RfA8Wz9OBPbLz6oQ=; b=BPx2K4ZXGnYXzK5JgeylWvbwF 58BClAHU7lhgnLHVlghhDHNO8lS2eT2spOoaxHvMz/0aB4FyyUxbmBTOmzmp+kiazBn8I+ixsmDHJ Ma6kuRu2koEUwAAtpAm4IHKTHJGPnypkzb4nMBRxOXV85F5gX5xWGPxRju6BMTwwPGmuzKObkKmM7 9nEgb4yTv7D68cA5KdxLfhuQyQ/0PlK4cx9LPVHsks9AejpbggkUyQUN25kvYmpJwESKnLpsZRZ6n d083bN854wQrxEN8jXPIeGVKmHSAebktu3tRFlPKnl90dxYV4eon7U8Z+vge27l8kkMSrYStkfxNb liZrv4/BA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBigp-0002cM-PT; Thu, 26 Apr 2018 15:20:08 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7830C203BFAE8; Thu, 26 Apr 2018 17:20:00 +0200 (CEST) Date: Thu, 26 Apr 2018 17:20:00 +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: <20180426152000.GB4082@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: > In the patch I used the logic, that the below code: > > x = A; > spin_lock(); > spin_unlock(); > spin_lock(); > spin_unlock(); > y = B; > > cannot reorder much than: > > spin_lock(); > x = A; <- this can't become visible later, that spin_unlock() > spin_unlock(); > spin_lock(); > y = B; <- this can't become visible earlier, than spin_lock() > spin_unlock(); > > Is there a problem? The two stores will be ordered, but only at the strength of an smp_wmb(). The above construct does not imply smp_mb(). The difference is observable on real hardware (Power).