Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942470AbcJ0PTh (ORCPT ); Thu, 27 Oct 2016 11:19:37 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43246 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936000AbcJ0PTa (ORCPT ); Thu, 27 Oct 2016 11:19:30 -0400 Date: Thu, 27 Oct 2016 11:44:49 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Linus Torvalds , Andy Lutomirski , Andreas Gruenbacher , Andy Lutomirski , LKML , Bob Peterson , Steven Whitehouse , linux-mm Subject: Re: CONFIG_VMAP_STACK, on-stack struct, and wake_up_bit Message-ID: <20161027094449.GL3102@twins.programming.kicks-ass.net> References: <20161026203158.GD2699@techsingularity.net> <20161026220339.GE2699@techsingularity.net> <20161026230726.GF2699@techsingularity.net> <20161027080852.GC3568@worktop.programming.kicks-ass.net> <20161027090742.GG2699@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161027090742.GG2699@techsingularity.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1974 Lines: 61 On Thu, Oct 27, 2016 at 10:07:42AM +0100, Mel Gorman wrote: > > Something like so could work I suppose, but then there's a slight > > regression in the page_unlock() path, where we now do an unconditional > > spinlock; iow. we loose the unlocked waitqueue_active() test. > > > > I can't convince myself it's worthwhile. At least, I can't see a penalty > of potentially moving one of the two bits to the high word. It's the > same cache line and the same op when it matters. I'm having trouble connecting these here two paragraphs. Or were you replying to something else? So the current unlock code does: wake_up_page() if (waitqueue_active()) __wake_up() /* takes waitqueue spinlocks here */ While the new one does: spin_lock(&q->lock); if (waitqueue_active()) { __wake_up_common() } spin_unlock(&q->lock); Which is an unconditional atomic op (which go for about ~20 cycles each, when uncontended). > > +++ b/include/linux/page-flags.h > > @@ -73,6 +73,14 @@ > > */ > > enum pageflags { > > PG_locked, /* Page is locked. Don't touch. */ > > +#ifdef CONFIG_NUMA > > + /* > > + * This bit must end up in the same word as PG_locked (or any other bit > > + * we're waiting on), as per all architectures their bitop > > + * implementations. > > + */ > > + PG_waiters, /* The hashed waitqueue has waiters */ > > +#endif > > PG_error, > > PG_referenced, > > PG_uptodate, > > I don't see why it should be NUMA-specific even though with Linus' > patch, NUMA is a concern. Even then, you still need a 64BIT check > because 32BIT && NUMA is allowed on a number of architectures. Oh, I thought we killed 32bit NUMA and didn't check. I can make it CONFIG_64BIT and be done with it. s/CONFIG_NUMA/CONFIG_64BIT/ on the patch should do :-) > Otherwise, nothing jumped out at me but glancing through it looked very > similar to the previous patch. Right, all the difference was in the bit being conditional and having a different name.