From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260AbcERKab (ORCPT ); Wed, 18 May 2016 06:30:31 -0400 Received: from merlin.infradead.org ([205.233.59.134]:37848 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbcERKaa (ORCPT ); Wed, 18 May 2016 06:30:30 -0400 Date: Wed, 18 May 2016 12:30:11 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Davidlohr Bueso , Jason Low , Dave Chinner , Peter Hurley , "Paul E. McKenney" , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v4 3/5] locking/rwsem: Don't wake up one's own task Message-ID: <20160518103011.GC3193@twins.programming.kicks-ass.net> References: <1463534783-38814-1-git-send-email-Waiman.Long@hpe.com> <1463534783-38814-4-git-send-email-Waiman.Long@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463534783-38814-4-git-send-email-Waiman.Long@hpe.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 17, 2016 at 09:26:21PM -0400, Waiman Long wrote: > As rwsem_down_read_failed() will queue itself and potentially call > __rwsem_do_wake(sem, RWSEM_WAKE_ANY), it is possible that a reader > will try to wake up its own task. This patch adds a check to make > sure that this won't happen. > Yes, this is 'weird', but why are we fixing it at the cost of an extra branch?