Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbcL2F0f (ORCPT ); Thu, 29 Dec 2016 00:26:35 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36046 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbcL2F0e (ORCPT ); Thu, 29 Dec 2016 00:26:34 -0500 Date: Thu, 29 Dec 2016 15:26:15 +1000 From: Nicholas Piggin To: Linus Torvalds Cc: Dave Hansen , Bob Peterson , Linux Kernel Mailing List , Steven Whitehouse , Andrew Lutomirski , Andreas Gruenbacher , Peter Zijlstra , linux-mm , Mel Gorman Subject: Re: [PATCH 2/2] mm: add PageWaiters indicating tasks are waiting for a page bit Message-ID: <20161229152615.2dad5402@roar.ozlabs.ibm.com> In-Reply-To: References: <20161225030030.23219-1-npiggin@gmail.com> <20161225030030.23219-3-npiggin@gmail.com> <20161226111654.76ab0957@roar.ozlabs.ibm.com> <20161227211946.3770b6ce@roar.ozlabs.ibm.com> <20161228135358.59f47204@roar.ozlabs.ibm.com> <20161229140837.5fff906d@roar.ozlabs.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1614 Lines: 44 On Wed, 28 Dec 2016 20:16:56 -0800 Linus Torvalds wrote: > On Wed, Dec 28, 2016 at 8:08 PM, Nicholas Piggin wrote: > > > > Okay. The name could be a bit better though I think, for readability. > > Just a BUILD_BUG_ON if it is not constant and correct bit numbers? > > I have a slightly edited patch - moved the comments around and added > some new comments (about both the sign bit, but also about how the > smp_mb() shouldn't be necessary even for the non-atomic fallback). That's a good point -- they're in the same byte, so all architectures will be able to avoid the extra barrier regardless of how the primitives are implemented. Good. > > I also did a BUILD_BUG_ON(), except the other way around - keeping it > about the sign bit in the byte, just just verifying that yes, > PG_waiters is that sign bit. Yep. I still don't like the name, but now you've got PG_waiters commented there at least. I'll have to live with it. If we get more cases that want to use a similar function, we might make a more general primitive for architectures that can optimize these multi bit ops better than x86. Actually even x86 would prefer to do load ; cmpxchg rather than bitop ; load for the cases where condition code can't be used to check result. > > > BTW. I just notice in your patch too that you didn't use "nr" in the > > generic version. > > And I fixed that too. > > Of course, I didn't test the changes (apart from building it). But > I've been running the previous version since yesterday, so far no > issues. It looks good to me. Thanks, Nick