From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755370AbcETBTe (ORCPT ); Thu, 19 May 2016 21:19:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:40206 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754103AbcETBTd (ORCPT ); Thu, 19 May 2016 21:19:33 -0400 Date: Thu, 19 May 2016 18:19:17 -0700 From: Davidlohr Bueso To: Jason Low Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Waiman Long , "Paul E. McKenney" , Terry Rudd , Scott J Norton , Jason Low Subject: Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE() Message-ID: <20160520011917.GB31084@linux-uzut.site> References: <1463696630.2587.95.camel@j-VirtualBox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1463696630.2587.95.camel@j-VirtualBox> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 May 2016, Jason Low wrote: >The mutex owner can get read and written to without the wait_lock. >Use WRITE_ONCE when setting and clearing the owner field in order >to avoid optimizations such as store tearing. This avoids >situations where the owner field gets written to with multiple >stores and another thread could concurrently read and use a >partially written owner value. Right, I also ran into this with rtmutexes when avoiding the schedule() and the spin on owner thingie. >Signed-off-by: Jason Low Acked-by: Davidlohr Bueso