From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751609AbbCOBJQ (ORCPT ); Sat, 14 Mar 2015 21:09:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42343 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbbCOBJN (ORCPT ); Sat, 14 Mar 2015 21:09:13 -0400 Message-ID: <1426381746.28068.70.camel@stgolabs.net> Subject: Re: Question on mutex code From: Davidlohr Bueso To: Matthias Bonne Cc: Yann Droneaud , kernelnewbies@kernelnewbies.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Date: Sat, 14 Mar 2015 18:09:06 -0700 In-Reply-To: <1426381401.28068.68.camel@stgolabs.net> References: <54F64E10.7050801@gmail.com> <1425992639.3991.11.camel@opteya.com> <5504BECB.50605@gmail.com> <1426381401.28068.68.camel@stgolabs.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2015-03-14 at 18:03 -0700, Davidlohr Bueso wrote: > Good analysis, but not quite accurate for one simple fact: mutex > trylocks _only_ use fastpaths (obviously just depend on the counter > cmpxchg to 0), so you never fallback to the slowpath you are mentioning, > thus the race is non existent. Please see the arch code. For debug we use the trylock slowpath, but so does everything else, so again you cannot hit this scenario.