From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755593AbeARRx3 (ORCPT ); Thu, 18 Jan 2018 12:53:29 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36863 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755248AbeARRx1 (ORCPT ); Thu, 18 Jan 2018 12:53:27 -0500 X-Google-Smtp-Source: ACJfBotSceKj+oeUmnoLmdJaIXNiwr2RqieZ/8XYaUD02vYkL+qHSEJF2AZ39psKeMcCJcF6dfINqg== Message-ID: <1516298004.2762.11.camel@arista.com> Subject: Re: [RFC 4/6] softirq: Run per-group per-cpu ksoftirqd thread From: Dmitry Safonov To: Mike Galbraith , linux-kernel@vger.kernel.org Cc: Andrew Morton , David Miller , Eric Dumazet , Frederic Weisbecker , Hannes Frederic Sowa , Ingo Molnar , "Levin, Alexander (Sasha Levin)" , Linus Torvalds , Mauro Carvalho Chehab , Paolo Abeni , "Paul E. McKenney" , Peter Zijlstra , Radu Rendec , Rik van Riel , Stanislaw Gruszka , Thomas Gleixner , Wanpeng Li Date: Thu, 18 Jan 2018 17:53:24 +0000 In-Reply-To: <1516294803.8020.11.camel@gmx.de> References: <20180118161238.13792-1-dima@arista.com> <20180118161238.13792-5-dima@arista.com> <1516294803.8020.11.camel@gmx.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-01-18 at 18:00 +0100, Mike Galbraith wrote: > On Thu, 2018-01-18 at 16:12 +0000, Dmitry Safonov wrote: > > > > diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h > > index 2ea09896bd6e..17e1a04445fa 100644 > > --- a/include/linux/interrupt.h > > +++ b/include/linux/interrupt.h > > @@ -508,11 +508,21 @@ extern void __raise_softirq_irqoff(unsigned > > int nr); > > extern void raise_softirq_irqoff(unsigned int nr); > > extern void raise_softirq(unsigned int nr); > > > > -DECLARE_PER_CPU(struct task_struct *, ksoftirqd); > > +extern struct task_struct *__percpu **ksoftirqd; > > +extern unsigned nr_softirq_groups; > > > > -static inline struct task_struct *this_cpu_ksoftirqd(void) > > +extern bool servicing_softirq(unsigned nr); > > +static inline bool current_is_ksoftirqd(void) > > { > > - return this_cpu_read(ksoftirqd); > > + unsigned i; > > + > > + if (!ksoftirqd) > > + return false; > > + > > + for (i = 0; i < nr_softirq_groups; i++) > > + if (*this_cpu_ptr(ksoftirqd[i]) == > > current) > > + return true; > > + return false; > > } > > I haven't read all this, but in a quick drive-by this poked me in the > eye. For RT tree fully threaded softirqs, I stole a ->flags bit to > identify threads ala PF_KTHREAD (PF_KSOFTIRQD). In previous > versions, > I added a bit field to do the same, either is quicker than rummaging. Yeah, thank you. It perfectly makes sense to use flags to identify ksoftirqd thread. How do you identify in RT one ksoftirqd thread from another? I mean, to find which softirq nr the thread is servicing? -- Thanks, Dmitry