Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754456Ab3I0T2T (ORCPT ); Fri, 27 Sep 2013 15:28:19 -0400 Received: from mail-vc0-f179.google.com ([209.85.220.179]:47777 "EHLO mail-vc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753618Ab3I0T2Q (ORCPT ); Fri, 27 Sep 2013 15:28:16 -0400 MIME-Version: 1.0 In-Reply-To: <1380308424-31011-1-git-send-email-Waiman.Long@hp.com> References: <1380308424-31011-1-git-send-email-Waiman.Long@hp.com> Date: Fri, 27 Sep 2013 12:28:15 -0700 X-Google-Sender-Auth: DBKK_92H1qvmMvA4CtVAhwILoio Message-ID: Subject: Re: [PATCH] rwsem: reduce spinlock contention in wakeup code path From: Linus Torvalds To: Waiman Long Cc: Ingo Molnar , Andrew Morton , Linux Kernel Mailing List , Rik van Riel , Peter Hurley , Davidlohr Bueso , Alex Shi , Tim Chen , Peter Zijlstra , Andrea Arcangeli , Matthew R Wilcox , Dave Hansen , Michel Lespinasse , Andi Kleen , "Chandramouleeswaran, Aswin" , "Norton, Scott J" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2000 Lines: 43 On Fri, Sep 27, 2013 at 12:00 PM, Waiman Long wrote: > > On a large NUMA machine, it is entirely possible that a fairly large > number of threads are queuing up in the ticket spinlock queue to do > the wakeup operation. In fact, only one will be needed. This patch > tries to reduce spinlock contention by doing just that. > > A new wakeup field is added to the rwsem structure. This field is > set on entry to rwsem_wake() and __rwsem_do_wake() to mark that a > thread is pending to do the wakeup call. It is cleared on exit from > those functions. Ok, this is *much* simpler than adding the new MCS spinlock, so I'm wondering what the performance difference between the two are. I'm obviously always in favor of just removing lock contention over trying to improve the lock scalability, so I really like Waiman's approach over Tim's new MCS lock. Not because I dislike MCS locks in general (or you, Tim ;), it's really more fundamental: I just fundamentally believe more in trying to avoid lock contention than in trying to improve lock behavior when that contention happens. As such, I love exactly these kinds of things that Wainman's patch does, and I'm heavily biased. But I know I'm heavily biased, so I'd really like to get comparative numbers for these things. Waiman, can you compare your patch with Tim's (and Alex's) 6-patch series to make the rwsem's use MCS locks for the spinlock? The numbers Tim quotes for the MCS patch series ("high_systime (+7%)") are lower than the ones you quote (16-20%), but that may be due to hardware platform differences and just methodology. Tim was also looking at exim performance. So Tim/Waiman, mind comparing the two approaches on the setups you have? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/