Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932450AbbDOClH (ORCPT ); Tue, 14 Apr 2015 22:41:07 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.227]:3090 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932157AbbDOCk7 (ORCPT ); Tue, 14 Apr 2015 22:40:59 -0400 Date: Tue, 14 Apr 2015 22:40:59 -0400 From: Steven Rostedt To: Jason Low Cc: Linus Torvalds , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Andrew Morton , Oleg Nesterov , Mike Galbraith , Frederic Weisbecker , Mel Gorman , Preeti U Murthy , hideaki.kimura@hp.com, Aswin Chandramouleeswaran , Scott J Norton Subject: Re: [PATCH 1/3] sched, timer: Remove usages of ACCESS_ONCE in the scheduler Message-ID: <20150414224059.061ec5bf@grimm.local.home> In-Reply-To: <1429063953.7039.88.camel@j-VirtualBox> References: <1429052986-9420-1-git-send-email-jason.low2@hp.com> <1429052986-9420-2-git-send-email-jason.low2@hp.com> <20150414195906.3adc89d9@gandalf.local.home> <1429063953.7039.88.camel@j-VirtualBox> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 40 On Tue, 14 Apr 2015 19:12:33 -0700 Jason Low wrote: > Hi Steven, > > On Tue, 2015-04-14 at 19:59 -0400, Steven Rostedt wrote: > > On Tue, 14 Apr 2015 16:09:44 -0700 > > Jason Low wrote: > > > > > > > @@ -2088,7 +2088,7 @@ void task_numa_fault(int last_cpupid, int mem_node, int pages, int flags) > > > > > > static void reset_ptenuma_scan(struct task_struct *p) > > > { > > > - ACCESS_ONCE(p->mm->numa_scan_seq)++; > > > + WRITE_ONCE(p->mm->numa_scan_seq, READ_ONCE(p->mm->numa_scan_seq) + 1); > > > > Is the READ_ONCE() inside the WRITE_ONCE() really necessary? > > Yeah, I think so to be safe, otherwise, the access of > p->mm->numa_scan_seq in the 2nd parameter doesn't have the volatile > cast. You are correct. Now I'm thinking that the WRITE_ONCE() is not needed, and just a: p->mm->numa_scan_seq = READ_ONCE(p->numa_scan_seq) + 1; Can be done. But I'm still trying to wrap my head around why this is needed here. Comments would have been really helpful. We should make all READ_ONCE() WRITE_ONCE and obsolete ACCESS_ONCE() have mandatory comments just like we do with memory barriers. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/