Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752283AbcL2EQ7 (ORCPT ); Wed, 28 Dec 2016 23:16:59 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:36544 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbcL2EQ5 (ORCPT ); Wed, 28 Dec 2016 23:16:57 -0500 MIME-Version: 1.0 In-Reply-To: <20161229140837.5fff906d@roar.ozlabs.ibm.com> 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> From: Linus Torvalds Date: Wed, 28 Dec 2016 20:16:56 -0800 X-Google-Sender-Auth: LINSU6FrPSwTH9UW9TWEPjpSCUQ Message-ID: Subject: Re: [PATCH 2/2] mm: add PageWaiters indicating tasks are waiting for a page bit To: Nicholas Piggin Cc: Dave Hansen , Bob Peterson , Linux Kernel Mailing List , Steven Whitehouse , Andrew Lutomirski , Andreas Gruenbacher , Peter Zijlstra , linux-mm , Mel Gorman Content-Type: multipart/mixed; boundary=94eb2c058c72274b180544c45b20 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6240 Lines: 100 --94eb2c058c72274b180544c45b20 Content-Type: text/plain; charset=UTF-8 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). 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. > 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. Linus --94eb2c058c72274b180544c45b20 Content-Type: text/plain; charset=US-ASCII; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ix9uzfl90 IGFyY2gveDg2L2luY2x1ZGUvYXNtL2JpdG9wcy5oIHwgMTMgKysrKysrKysrKysrKwogaW5jbHVk ZS9saW51eC9wYWdlLWZsYWdzLmggICAgfCAgMiArLQogbW0vZmlsZW1hcC5jICAgICAgICAgICAg ICAgICAgfCAzNiArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrLS0tLS0KIDMgZmlsZXMg Y2hhbmdlZCwgNDUgaW5zZXJ0aW9ucygrKSwgNiBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9h cmNoL3g4Ni9pbmNsdWRlL2FzbS9iaXRvcHMuaCBiL2FyY2gveDg2L2luY2x1ZGUvYXNtL2JpdG9w cy5oCmluZGV4IDY4NTU3ZjUyYjk2MS4uODU0MDIyNzcyYzViIDEwMDY0NAotLS0gYS9hcmNoL3g4 Ni9pbmNsdWRlL2FzbS9iaXRvcHMuaAorKysgYi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9iaXRvcHMu aApAQCAtMTM5LDYgKzEzOSwxOSBAQCBzdGF0aWMgX19hbHdheXNfaW5saW5lIHZvaWQgX19jbGVh cl9iaXQobG9uZyBuciwgdm9sYXRpbGUgdW5zaWduZWQgbG9uZyAqYWRkcikKIAlhc20gdm9sYXRp bGUoImJ0ciAlMSwlMCIgOiBBRERSIDogIklyIiAobnIpKTsKIH0KIAorc3RhdGljIF9fYWx3YXlz X2lubGluZSBib29sIGNsZWFyX2JpdF91bmxvY2tfaXNfbmVnYXRpdmVfYnl0ZShsb25nIG5yLCB2 b2xhdGlsZSB1bnNpZ25lZCBsb25nICphZGRyKQoreworCWJvb2wgbmVnYXRpdmU7CisJYXNtIHZv bGF0aW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