From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbbIOH5w (ORCPT ); Tue, 15 Sep 2015 03:57:52 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:48099 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbbIOH5v (ORCPT ); Tue, 15 Sep 2015 03:57:51 -0400 Date: Tue, 15 Sep 2015 09:57:41 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Ingo Molnar , Sasha Levin , wanpeng.li@hotmail.com, Peter Anvin , Huang Ying , Linux Kernel Mailing List , Thomas Gleixner , "linux-tip-commits@vger.kernel.org" Subject: Re: [tip:sched/core] sched: 'Annotate' migrate_tasks() Message-ID: <20150915075741.GV16853@twins.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Sep 14, 2015 at 04:58:21PM -0700, Linus Torvalds wrote: > On Sun, Sep 13, 2015 at 3:56 AM, tip-bot for Wanpeng Li > wrote: > > + lockdep_unpin_lock(&rq->lock); > > + raw_spin_unlock(&rq->lock); > > + raw_spin_lock(&next->pi_lock); > > + raw_spin_lock(&rq->lock); > > So _if_ this is ever likely to be a performance-critical piece of > code, it might be worth doing > > if (!raw_spin_trylock(&next->pi_lock)) { > .. do the above unlock and relock in the right order sequence .. > } > > to avoid doing that whole "unlock just to relock in the right order" thing. > > That's particularly true in cases where dropping one of the locks can > necessitate re-doing some checks. Correct, but this is the hot-unplug, migrate the few tasks that are now on a dead CPU away path, so meh ;-)