From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935780AbcJGDPK (ORCPT ); Thu, 6 Oct 2016 23:15:10 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:43788 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754042AbcJGDPI (ORCPT ); Thu, 6 Oct 2016 23:15:08 -0400 Date: Fri, 7 Oct 2016 05:15:01 +0200 From: Steffen Klassert To: "Jason A. Donenfeld" CC: , Subject: Re: [PATCH] padata: add helper function for queue length Message-ID: <20161007031501.GB23615@gauss.secunet.com> References: <20161002014638.8049-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161002014638.8049-1-Jason@zx2c4.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.182.7.102] X-G-Data-MailSecurity-for-Exchange-SpamLevel: 0 X-G-Data-MailSecurity-for-Exchange-SpamFilter: 0;1;str=0001.0A0C0203.57F71336.0081,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 32 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: D14CD464-43A5-429F-9104-C45A52EE1EF6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 02, 2016 at 03:46:38AM +0200, Jason A. Donenfeld wrote: > Since padata has a maximum number of inflight jobs, currently 1000, it's > very useful to know how many jobs are currently queued up. This adds a > simple helper function to expose this information. > > Signed-off-by: Jason A. Donenfeld > --- > include/linux/padata.h | 2 ++ > kernel/padata.c | 16 ++++++++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/include/linux/padata.h b/include/linux/padata.h > index 113ee62..4840ae4 100644 > --- a/include/linux/padata.h > +++ b/include/linux/padata.h > @@ -3,6 +3,7 @@ > * > * Copyright (C) 2008, 2009 secunet Security Networks AG > * Copyright (C) 2008, 2009 Steffen Klassert > + * Copyright (C) 2016 Jason A. Donenfeld > * > * This program is free software; you can redistribute it and/or modify it > * under the terms and conditions of the GNU General Public License, > @@ -181,4 +182,5 @@ extern int padata_register_cpumask_notifier(struct padata_instance *pinst, > struct notifier_block *nblock); > extern int padata_unregister_cpumask_notifier(struct padata_instance *pinst, > struct notifier_block *nblock); > +extern int padata_queue_len(struct padata_instance *pinst); > #endif > diff --git a/kernel/padata.c b/kernel/padata.c > index 9932788..17c1e08 100644 > --- a/kernel/padata.c > +++ b/kernel/padata.c > @@ -5,6 +5,7 @@ > * > * Copyright (C) 2008, 2009 secunet Security Networks AG > * Copyright (C) 2008, 2009 Steffen Klassert > + * Copyright (C) 2016 Jason A. Donenfeld > * > * This program is free software; you can redistribute it and/or modify it > * under the terms and conditions of the GNU General Public License, > @@ -1039,3 +1040,18 @@ void padata_free(struct padata_instance *pinst) > kobject_put(&pinst->kobj); > } > EXPORT_SYMBOL(padata_free); > + > +/** > + * padata_queue_len - retreive the number of in progress jobs > + * > + * @padata_inst: padata instance from which to read the queue size > + */ > +int padata_queue_len(struct padata_instance *pinst) > +{ > + int len; > + rcu_read_lock_bh(); > + len = atomic_read(&rcu_dereference_bh(pinst->pd)->refcnt); > + rcu_read_unlock_bh(); > + return len; > +} > +EXPORT_SYMBOL(padata_queue_len); Why you want to have this? Without having a user of this function, there is no point on adding it.