Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5009150imu; Tue, 29 Jan 2019 11:10:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4VSLyKIV0D6Z1xfSv9Gpha7pex71dZDzWBSSuXagd3uB4Fou9aRE+q1cN4hsX52VwztJH2 X-Received: by 2002:a63:a30a:: with SMTP id s10mr17066498pge.234.1548789052935; Tue, 29 Jan 2019 11:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548789052; cv=none; d=google.com; s=arc-20160816; b=vHGZNkbHbVX3+wFxRDOvMPIwO7CwDDLxK1jLnBgiDg2PpyhSEtL/hHSSLpkI6LLIPa AwrEz3A4GvdvkvcMXGaOgnskpBAtmBpF/Zj0/geDBAfN/QqtkR5cQVoist3r2ROg1NpC RKLcUYc6QAtthoWtdph79hgOK5w5l8rCIhNcyKIRerXnGWy6mf/SffY1o1jAp00T74O4 KHR7msisCRo1WM3otoHVVLofDpXCOfYtZUrEX1cPjFd8DiXTdyMqQJ1FSVVZv3LBDV+B Q4dTjdeGRUyxQ6mRbxASkDFL/AMkNKzw12kh0EpgYHAPXxnNcxlZMZm3CPUq7k/CUXXz U7aw== 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; bh=Cua5YyY3UCe/2GZUwqOSzY6Efy7wQkjzkYSxkI+PGIc=; b=a97T02bRz0P4zutuNoni56w7xNlRxzZAcYxuE6j6O1x0D0IiE5HiL1u8Gwxr7JCE2P 1+pHXCs9VQt8QjBvUb9FHTDAjqF7rP8iUqyI6bpB53XHjqtzlKOAyBFq+DuDm79s5mjW Zp0YttEtaKyxU4I6YieQnSEEta+ToLJIT5t1QVGWMRU81Q1Yv0HTIg6bwInusDQ+UCFg 75pA1Rljj5lYtJAgWvfQl2m6+7Wt2EH0l1GCIsVwvpbFPH/pFjl7A0q5vldjSlfpjk3P Wt+/DrJuTb5SBGVU0PtnpYIXwFLbA3tot0Ra7FaZnOvJngQCqI2gCBtgADhQLcBGO8RO bojg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gVcqUjmO; 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 w2si37263987pfg.78.2019.01.29.11.10.37; Tue, 29 Jan 2019 11:10:52 -0800 (PST) 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=gVcqUjmO; 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 S1729319AbfA2TJH (ORCPT + 99 others); Tue, 29 Jan 2019 14:09:07 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58176 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbfA2TJH (ORCPT ); Tue, 29 Jan 2019 14:09:07 -0500 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=Cua5YyY3UCe/2GZUwqOSzY6Efy7wQkjzkYSxkI+PGIc=; b=gVcqUjmOXq5LVw8P80svC9HYP AV8bRa1e6rYmZwXtE6cNeG0FGcm8XcguwKoNEFRTx7ABc+Nx/PtM4QjuVMLk/RfooU0lRdnkWxOqT QRzoVNadl1qrmH2b/smBvJ9lU7mKAOS0dIfiwUBYj+kivO4cslH6ojOFJH/BPXeYDEcZWq2+4VDuH KymK/JiSENNQxnkaa9PJ5pz11okYs9d5b4ZeGmCvOtzi8CKSuHWlJUnZhwhOn4KQ4rEiylU4FISEn iLyexJFSEeziwNmFVxQ7FBZ122QdaCxlvNN0P6++7mqVuXcvrpnc6QI7RMXH5dLVQs1bJW0S+fMlb WpgokPBRg==; 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 1goYkf-0003Mo-DW; Tue, 29 Jan 2019 19:08:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 84A3F201EC171; Tue, 29 Jan 2019 20:08:51 +0100 (CET) Date: Tue, 29 Jan 2019 20:08:51 +0100 From: Peter Zijlstra To: Suren Baghdasaryan Cc: Greg Kroah-Hartman , Tejun Heo , lizefan@huawei.com, Johannes Weiner , axboe@kernel.dk, dennis@kernel.org, Dennis Zhou , Ingo Molnar , Andrew Morton , Jonathan Corbet , cgroups@vger.kernel.org, linux-mm , linux-doc@vger.kernel.org, LKML , kernel-team@android.com Subject: Re: [PATCH v3 5/5] psi: introduce psi monitor Message-ID: <20190129190851.GA2961@hirez.programming.kicks-ass.net> References: <20190124211518.244221-1-surenb@google.com> <20190124211518.244221-6-surenb@google.com> <20190129123843.GK28467@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 10:18:20AM -0800, Suren Baghdasaryan wrote: > On Tue, Jan 29, 2019 at 4:38 AM Peter Zijlstra wrote: > > > > On Thu, Jan 24, 2019 at 01:15:18PM -0800, Suren Baghdasaryan wrote: > > > + atomic_set(&group->polling, polling); > > > + /* > > > + * Memory barrier is needed to order group->polling > > > + * write before times[] read in collect_percpu_times() > > > + */ > > > + smp_mb__after_atomic(); > > > > That's broken, smp_mb__{before,after}_atomic() can only be used on > > atomic RmW operations, something atomic_set() is _not_. > > Oh, I didn't realize that. After reading the following example from > atomic_ops.txt That document it woefully out of date (and I should double check, but I think we can actually delete it now). Please see Documentation/atomic_t.txt > I was under impression that smp_mb__after_atomic() > would make changes done by atomic_set() visible: > > /* All memory operations before this call will > * be globally visible before the clear_bit(). > */ > smp_mb__before_atomic(); > clear_bit( ... ); > /* The clear_bit() will be visible before all > * subsequent memory operations. > */ > smp_mb__after_atomic(); > > but I'm probably missing something. Is there a more detailed > description of these rules anywhere else? See atomic_t.txt; but the difference is that clear_bit() is a RmW, while atomic_set() is just a plain store. > Meanwhile I'll change smp_mb__after_atomic() into smp_mb(). Would that > fix the ordering? It would work here; but I'm still trying to actually understand all this. So while the detail would be fine, I'm not ready to judge the over-all thing.