From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by kanga.kvack.org (Postfix) with ESMTP id A056D6B0036 for ; Fri, 27 Sep 2013 02:27:01 -0400 (EDT) Received: by mail-pa0-f54.google.com with SMTP id kx10so2375743pab.27 for ; Thu, 26 Sep 2013 23:27:01 -0700 (PDT) Message-ID: <1380263214.5774.12.camel@j-VirtualBox> Subject: Re: [PATCH v6 5/6] MCS Lock: Restructure the MCS lock defines and locking code into its own file From: Jason Low Date: Thu, 26 Sep 2013 23:26:54 -0700 In-Reply-To: <20130927060213.GA6673@gmail.com> References: <1380147049.3467.67.camel@schen9-DESK> <1380226007.2170.2.camel@buesod1.americas.hpqcorp.net> <1380226997.2602.11.camel@j-VirtualBox> <1380228059.2170.10.camel@buesod1.americas.hpqcorp.net> <1380229794.2602.36.camel@j-VirtualBox> <1380231702.3467.85.camel@schen9-DESK> <1380235333.3229.39.camel@j-VirtualBox> <1380236265.3467.103.camel@schen9-DESK> <20130927060213.GA6673@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: owner-linux-mm@kvack.org List-ID: To: Ingo Molnar Cc: Tim Chen , Davidlohr Bueso , Ingo Molnar , Andrew Morton , Andrea Arcangeli , Alex Shi , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Matthew R Wilcox , Dave Hansen , Peter Zijlstra , Rik van Riel , Peter Hurley , linux-kernel@vger.kernel.org, linux-mm On Fri, 2013-09-27 at 08:02 +0200, Ingo Molnar wrote: > * Tim Chen wrote: > > > > If we prefer to optimize this a bit though, perhaps we can first move > > > the node->lock = 0 so that it gets executed after the "if (likely(prev > > > == NULL)) {}" code block and then delete "node->lock = 1" inside the > > > code block. > > > > I suppose we can save one single assignment. The gain is probably not > > noticeable as once we set node->next to NULL, node->locked is likely in > > local cache line and the assignment operation is cheap. > > Would be nice to have this as a separate, add-on patch. Every single > instruction removal that has no downside is an upside! > > You can add a comment that explains it. Yup, especially a spin lock (and one that I have found to be be used very frequently when running workloads on big machines). -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org