From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753954AbaJCPli (ORCPT ); Fri, 3 Oct 2014 11:41:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58664 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753687AbaJCPlf (ORCPT ); Fri, 3 Oct 2014 11:41:35 -0400 Date: Fri, 3 Oct 2014 17:41:34 +0200 From: Michal Hocko To: Vladimir Davydov Cc: Johannes Weiner , linux-mm@kvack.org, Greg Thelen , Dave Hansen , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [patch 1/3] mm: memcontrol: lockless page counters Message-ID: <20141003154134.GG4816@dhcp22.suse.cz> References: <1411573390-9601-1-git-send-email-hannes@cmpxchg.org> <1411573390-9601-2-git-send-email-hannes@cmpxchg.org> <20140926103104.GE29445@esperanza> <20141002120748.GA1359@cmpxchg.org> <20141003153623.GA1162@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141003153623.GA1162@esperanza> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 03-10-14 19:36:23, Vladimir Davydov wrote: > On Thu, Oct 02, 2014 at 08:07:48AM -0400, Johannes Weiner wrote: [...] > > The barriers are implied in change-return atomics, which is why there > > is an xchg. But it's clear that this needs to be documented. This?: > > With the comments it looks correct to me, but I wonder if we can always > rely on implicit memory barriers issued by atomic ops. Are there any > archs where it doesn't hold? xchg is explcitly mentioned in Documentation/memory-barriers.txt so it is expected to be barrier on all archs. Besides that not all atomic ops imply memory barriers. Only those that "modifies some state in memory and returns information about the state" do. -- Michal Hocko SUSE Labs