Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933631AbcJZRPe (ORCPT ); Wed, 26 Oct 2016 13:15:34 -0400 Received: from mail-oi0-f44.google.com ([209.85.218.44]:35734 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932960AbcJZRPc (ORCPT ); Wed, 26 Oct 2016 13:15:32 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Linus Torvalds Date: Wed, 26 Oct 2016 10:15:30 -0700 X-Google-Sender-Auth: -zTCHqWxTGgYy0xKuBOlQxovOno Message-ID: Subject: Re: CONFIG_VMAP_STACK, on-stack struct, and wake_up_bit To: Andy Lutomirski Cc: Andreas Gruenbacher , Peter Zijlstra , Andy Lutomirski , LKML , Bob Peterson , Steven Whitehouse , Mel Gorman , linux-mm Content-Type: multipart/mixed; boundary=001a11c060b6b22246053fc7c5cb Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 16015 Lines: 237 --001a11c060b6b22246053fc7c5cb Content-Type: text/plain; charset=UTF-8 On Wed, Oct 26, 2016 at 9:32 AM, Linus Torvalds wrote: > > Quite frankly, I think the solution is to just rip out all the insane > zone crap. IOW, something like the attached. Advantage: - just look at the number of garbage lines removed! 21 insertions(+), 182 deletions(-) - it will actually speed up even the current case for all common situations: no idiotic extra indirections that will take extra cache misses - because the bit_wait_table array is now denser (256 entries is about 6kB of data on 64-bit with no spinlock debugging, so ~100 cachelines), maybe it gets fewer cache misses too - we know how to handle the page_waitqueue contention issue, and it has nothing to do with the stupid NUMA zones The only case you actually get real page wait activity is IO, and I suspect that hashing it out over ~100 cachelines will be more than sufficient to avoid excessive contention, plus it's a cache-miss vs an IO, so nobody sane cares. The only reason it did that insane per-zone thing in the first place that right now we access those wait-queues even when we damn well shouldn't, and we have the solution for that. Guys, holler if you hate this, but I think it's realistically the only sane solution to the "wait queue on stack" issue. Oh, and the patch is obviously entirely untested. I wouldn't want to ruin my reputation by *testing* the patches I send out. What would be the fun in that? Linus --001a11c060b6b22246053fc7c5cb Content-Type: text/plain; charset=US-ASCII; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_iur6l9iu0 IGluY2x1ZGUvbGludXgvbW16b25lLmggfCAgMzAgKy0tLS0tLS0tLS0tLQoga2VybmVsL3NjaGVk L2NvcmUuYyAgICB8ICAxNiArKysrKysrCiBrZXJuZWwvc2NoZWQvd2FpdC5jICAgIHwgIDEwIC0t LS0tCiBtbS9maWxlbWFwLmMgICAgICAgICAgIHwgICA0ICstCiBtbS9tZW1vcnlfaG90cGx1Zy5j ICAgIHwgIDI4IC0tLS0tLS0tLS0tLQogbW0vcGFnZV9hbGxvYy5jICAgICAgICB8IDExNSArLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiA2IGZpbGVzIGNo YW5nZWQsIDIxIGluc2VydGlvbnMoKyksIDE4MiBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9p bmNsdWRlL2xpbnV4L21tem9uZS5oIGIvaW5jbHVkZS9saW51eC9tbXpvbmUuaAppbmRleCA3ZjJh ZTk5ZTVkYWYuLjBmMDg4ZjNhMmZlZCAxMDA2NDQKLS0tIGEvaW5jbHVkZS9saW51eC9tbXpvbmUu aAorKysgYi9pbmNsdWRlL2xpbnV4L21tem9uZS5oCkBAIC00NDAsMzMgKzQ0MCw3IEBAIHN0cnVj dCB6b25lIHsKIAlzZXFsb2NrX3QJCXNwYW5fc2VxbG9jazsKICNlbmRpZgogCi0JLyoKLQkgKiB3 YWl0X3RhYmxlCQktLSB0aGUgYXJyYXkgaG9sZGluZyB0aGUgaGFzaCB0YWJsZQotCSAqIHdhaXRf dGFibGVfaGFzaF9ucl9lbnRyaWVzCS0tIHRoZSBzaXplIG9mIHRoZSBoYXNoIHRhYmxlIGFycmF5 Ci0JICogd2FpdF90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