From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759748AbbA3JO6 (ORCPT ); Fri, 30 Jan 2015 04:14:58 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:48156 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754027AbbA3JOw (ORCPT ); Fri, 30 Jan 2015 04:14:52 -0500 From: Davidlohr Bueso To: Peter Zijlstra , Ingo Molnar Cc: "Paul E. McKenney" , Jason Low , Michel Lespinasse , Tim Chen , linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH -tip v2 0/5] rwsem: Fine tuning Date: Fri, 30 Jan 2015 01:14:22 -0800 Message-Id: <1422609267-15102-1-git-send-email-dave@stgolabs.net> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, First two patches are self descriptive obvious add-ons. The rest are performance enhancements for write-mostly workloads. While this is not our priority (use mutexes instead!!), there are cases where heavy use of writers can severely hurt rwsem performance. For instance, we got reports[1] of writer only issues when converting the i_mmap_rwsem from mutex, on a workload that pathologically pounds on this lock for vma operations: - 81.20% execl [kernel.kallsyms] [k] osq_lock - 100.00% mutex_optimistic_spin __mutex_lock_slowpath - mutex_lock + 47.71% unlink_file_vma + 34.91% vma_adjust + 17.38% vma_link This is enough to make small differences painfully evident. These changes (particularly patch 5/5) recover most (~75%) of the performance regression. Patches 3- 5 deal with optimistic spinning fine tuning. Details are in the individual patches. Passes multiple x86-64 tests. Thanks! Changes since v1 (https://lkml.org/lkml/2015/1/26/34): - Redid patch 2. - Improved "Check for active lock before bailing on spinning" patch to consider checking if the lock has a new owner. - Dropped patch 5, will send a new patch later disabling preemption in the slowpath to get rid of the barriers (assuming testing goes well) without missing wakeups. It's not very related to the patches in this series anyway. Davidlohr Bueso (5): locking/rwsem: Use task->state helpers locking/rwsem: Document barrier need when waking tasks locking/rwsem: Set lock ownership ASAP locking/rwsem: Avoid deceiving lock spinners locking/rwsem: Check for active lock before bailing on spinning kernel/locking/mutex.c | 2 +- kernel/locking/rwsem-spinlock.c | 9 +++++- kernel/locking/rwsem-xadd.c | 66 ++++++++++++++++++++++++++++------------- kernel/locking/rwsem.c | 22 +------------- kernel/locking/rwsem.h | 20 +++++++++++++ 5 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 kernel/locking/rwsem.h -- 2.1.4