Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761979AbcLUSqv (ORCPT ); Wed, 21 Dec 2016 13:46:51 -0500 Received: from mail-wj0-f173.google.com ([209.85.210.173]:36250 "EHLO mail-wj0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757037AbcLUSqt (ORCPT ); Wed, 21 Dec 2016 13:46:49 -0500 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 00/12] locking/ww_mutex: Keep sorted wait list to avoid stampedes Date: Wed, 21 Dec 2016 19:46:28 +0100 Message-Id: <1482346000-9927-1-git-send-email-nhaehnle@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1185 Lines: 29 Here's a v3 of the series. Some comments: Patch #1 is already in drm-misc, but I left it here for now for completeness. Patch #2 is new and affects all types of locks, not just the w/w case. It's a race that is exceedingly unlikely: basically, we have to be interrupted right between checking our wait_list position and setting the task state for long enough that two other tasks can conspire against us in the meantime (and one of them must have received a signal). Patch #5 is also new; it gets rid of the static inline ww_mutex_lock wrappers. Patch #6 (the heart of the series): Changed to be much less invasive to the trylock calls. I've also changed the __ww_mutex_add_waiter loop to scan the wait list in reverse order. It's probably a wash overall. I kept the logic as far as setting ww_ctx in mutex_waiter is concerned. About the changes to optimistic spin: I've moved them towards the end so that they're easy to take or leave. They didn't change much in my measurements, so I'm not very attached to them, but they do seem more "right" to me for the w/w case. Is there a verdict on the whole "use_ww_ctx doesn't work for mutex_spin_on_owner" question? Thanks, Nicolai