From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH v8 4/5] locking/qspinlock: Introduce starvation avoidance into CNA Date: Sat, 25 Jan 2020 12:20:39 +0100 Message-ID: <20200125112039.GX11457@worktop.programming.kicks-ass.net> References: <3862F8A1-FF9B-40AD-A88E-2C0BA7AF6F58@oracle.com> <20200124075235.GX14914@hirez.programming.kicks-ass.net> <2c6741c5-d89d-4b2c-cebe-a7c7f6eed884@redhat.com> <48ce49e5-98a7-23cd-09f4-8290a65abbb5@redhat.com> <8D3AFB47-B595-418C-9568-08780DDC58FF@oracle.com> <714892cd-d96f-4d41-ae8b-d7b7642a6e3c@redhat.com> <1669BFDE-A1A5-4ED8-B586-035460BBF68A@oracle.com> <45660873-731a-a810-8c57-1a5a19d266b4@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane-mx.org@lists.infradead.org To: Waiman Long Cc: linux-arch@vger.kernel.org, Hanjun Guo , Arnd Bergmann , dave.dice@oracle.com, Jan Glauber , x86@kernel.org, Will Deacon , linux@armlinux.org.uk, linux-kernel@vger.kernel.org, Ingo Molnar , Borislav Petkov , hpa@zytor.com, Alex Kogan , Steven Sistare , Thomas Gleixner , Daniel Jordan , linux-arm-kernel List-Id: linux-arch.vger.kernel.org On Fri, Jan 24, 2020 at 01:51:34PM -0500, Waiman Long wrote: < 71 lines of garbage > > > You can use the in_task() macro in include/linux/preempt.h. This is > > just a percpu preempt_count read and test. If in_task() is false, it > > is in a {soft|hard}irq or nmi context. If it is true, you can check > > the rt_task() macro to see if it is an RT task. That will access to > > the current task structure. So it may cost a little bit more if you > > want to handle the RT task the same way. > > > We may not need to do that for softIRQ context. If that is the case, you > can use in_irq() which checks for hardirq and nmi only. Peter, what is > your thought on that? Can you lot please start trimming emails when you reply? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:52478 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgAYLU6 (ORCPT ); Sat, 25 Jan 2020 06:20:58 -0500 Date: Sat, 25 Jan 2020 12:20:39 +0100 From: Peter Zijlstra Subject: Re: [PATCH v8 4/5] locking/qspinlock: Introduce starvation avoidance into CNA Message-ID: <20200125112039.GX11457@worktop.programming.kicks-ass.net> References: <3862F8A1-FF9B-40AD-A88E-2C0BA7AF6F58@oracle.com> <20200124075235.GX14914@hirez.programming.kicks-ass.net> <2c6741c5-d89d-4b2c-cebe-a7c7f6eed884@redhat.com> <48ce49e5-98a7-23cd-09f4-8290a65abbb5@redhat.com> <8D3AFB47-B595-418C-9568-08780DDC58FF@oracle.com> <714892cd-d96f-4d41-ae8b-d7b7642a6e3c@redhat.com> <1669BFDE-A1A5-4ED8-B586-035460BBF68A@oracle.com> <45660873-731a-a810-8c57-1a5a19d266b4@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Waiman Long Cc: Alex Kogan , linux@armlinux.org.uk, Ingo Molnar , Will Deacon , Arnd Bergmann , linux-arch@vger.kernel.org, linux-arm-kernel , linux-kernel@vger.kernel.org, Thomas Gleixner , Borislav Petkov , hpa@zytor.com, x86@kernel.org, Hanjun Guo , Jan Glauber , Steven Sistare , Daniel Jordan , dave.dice@oracle.com Message-ID: <20200125112039.brfK-2UsVG_FYd7iTnMUIc6SD_9YxiunNsRVqntX4ho@z> On Fri, Jan 24, 2020 at 01:51:34PM -0500, Waiman Long wrote: < 71 lines of garbage > > > You can use the in_task() macro in include/linux/preempt.h. This is > > just a percpu preempt_count read and test. If in_task() is false, it > > is in a {soft|hard}irq or nmi context. If it is true, you can check > > the rt_task() macro to see if it is an RT task. That will access to > > the current task structure. So it may cost a little bit more if you > > want to handle the RT task the same way. > > > We may not need to do that for softIRQ context. If that is the case, you > can use in_irq() which checks for hardirq and nmi only. Peter, what is > your thought on that? Can you lot please start trimming emails when you reply?