From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 921D2C54EE9 for ; Thu, 8 Sep 2022 17:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiIHREA (ORCPT ); Thu, 8 Sep 2022 13:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbiIHRD6 (ORCPT ); Thu, 8 Sep 2022 13:03:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1343EA63F for ; Thu, 8 Sep 2022 10:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=S72PXY7em62V5ORzoBo68HbWhNjf9hfLKLeX6cFiRBw=; b=X1xuCy4RuMs5gUYI1iEwbPB2FI xQqAjy+a28O2Ik8P/N6sTMrFVGAbbkg2PANdVLnLBKLnS2eFZhXrfBIb5VX0s4IquBcbSZAk9RXhE TDZTcNpKLPdZfNTBRFCegJ7xrStOXFEos7XicKF1W41myg1Eo7UwO0atKEtjw2Ds/Y5zIIRHrejXY 84RB/2tPV0hJAh+y/7UGVOOEjVnwJHrv10tbtrF57tLs1hMCcg3uLEi9ZbDB5BjOooXTKtnNfCtlz 893sVtbNOwKEO9tKdlKG8LGT1WZIiYnbk8q+ybi97wLGzCbbOAOjyA5riVeTom/lO66RwMSQxkghO deBbyHgw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oWKwL-00CW3s-4L; Thu, 08 Sep 2022 17:03:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0708B3006A4; Thu, 8 Sep 2022 19:03:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ECFD42B9A6AC0; Thu, 8 Sep 2022 19:03:41 +0200 (CEST) Date: Thu, 8 Sep 2022 19:03:41 +0200 From: Peter Zijlstra To: Mukesh Ojha Cc: mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, Gokul krishna Krishnakumar Subject: Re: [PATCH] locking/rwsem: Disable preemption while trying for rwsem lock Message-ID: References: <1662028090-26495-1-git-send-email-quic_mojha@quicinc.com> <0aafd6bd-6c4c-bb77-7b33-a6d04ee6e5b3@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0aafd6bd-6c4c-bb77-7b33-a6d04ee6e5b3@quicinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 08, 2022 at 09:18:29PM +0530, Mukesh Ojha wrote: > Hi Peter, > > Thanks for your time in reviewing this patch. > > On 9/8/2022 8:02 PM, Peter Zijlstra wrote: > > On Thu, Sep 01, 2022 at 03:58:10PM +0530, Mukesh Ojha wrote: > > > From: Gokul krishna Krishnakumar > > > > > > Make the region inside the rwsem_write_trylock non preemptible. > > > > > > We observe RT task is hogging CPU when trying to acquire rwsem lock > > > which was acquired by a kworker task but before the rwsem owner was set. > > > > > > Here is the scenario: > > > 1. CFS task (affined to a particular CPU) takes rwsem lock. > > > > > > 2. CFS task gets preempted by a RT task before setting owner. > > > > > > 3. RT task (FIFO) is trying to acquire the lock, but spinning until > > > RT throttling happens for the lock as the lock was taken by CFS task. > > > > > > This patch attempts to fix the above issue by disabling preemption > > > until owner is set for the lock. while at it also fix this issue > > > at the place where owner being set/cleared. > > > > > > Signed-off-by: Gokul krishna Krishnakumar > > > Signed-off-by: Mukesh Ojha > > > > This is not a valid SoB chain. > > Since this patch of adding preempt disable() at rwsem_write_trylock() is > originated from Gokul. > > Would be adding him in > Original-patch-by: Gokul krishna Krishnakumar > > Convert myself to the author/SoB. > Oh, my bad, I missed From is actually Gokul. So yeah, all good, ignore that.