From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934543AbaFSVCI (ORCPT ); Thu, 19 Jun 2014 17:02:08 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:50611 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932343AbaFSVCF (ORCPT ); Thu, 19 Jun 2014 17:02:05 -0400 Date: Thu, 19 Jun 2014 14:00:31 -0700 From: "Paul E. McKenney" To: Joe Perches Cc: Julia Lawall , Dan Carpenter , Andrew Morton , Andy Whitcroft , LKML , benoit.taine@lip6.fr, romanov.arya@gmail.com, bobby.prani@gmail.com Subject: Re: [RFC PATCH] checkpatch: Attempt to find unnecessary 'out of memory' messages Message-ID: <20140619210031.GN4904@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1402419340.30479.18.camel@joe-AO725> <20140611074704.GS5015@mwanda> <1402502500.6169.5.camel@joe-AO725> <20140618193345.GR4669@linux.vnet.ibm.com> <1403120982.3839.25.camel@joe-AO725> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403120982.3839.25.camel@joe-AO725> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14061921-3532-0000-0000-00000296DAFD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 18, 2014 at 12:49:42PM -0700, Joe Perches wrote: > On Wed, 2014-06-18 at 12:33 -0700, Paul E. McKenney wrote: > > On Sat, Jun 14, 2014 at 11:51:41AM +0200, Julia Lawall wrote: > > > On Sat, 14 Jun 2014, Julia Lawall wrote: > > > > With a semantic patch that searches for the various calls and then a > > > > string containing the letters "emory", I get removals of the messages > > > > below. Do any of these messages look useful? For example, some are > > > > generated with specific functions, such as IRDA_ERROR or BT_ERR. If none > > > > of the messages look useful, should just one big patch go to trivial, or > > > > should the patches go to the individual maintainers? > > > > > > Sorry, I left out all the strings... > > > > I would like the rcu-torture message to stay: > > > > > - pr_err("rcu-torture: Out of memory, need: %d", size); > > > > This is in a module that is not loaded into any reasonable production > > kernel, and has helped me to catch typos. > > I believe the function doesn't work well. > > static void > rcu_torture_stats_print(void) > { > int size = nr_cpu_ids * 200 + 8192; > char *buf; > > buf = kmalloc(size, GFP_KERNEL); > if (!buf) { > pr_err("rcu-torture: Out of memory, need: %d\n", size); > return; > } > rcu_torture_printk(buf); > pr_alert("%s", buf); > kfree(buf); > } > > rcu_torture_printk simply fills buf > > btw: I believe the arguments should pass size and > rcu_torture_printk should use snprintf/size > > but all printks are limited to a maximum of 1024 > bytes so the large allocation is senseless and > would even if it worked, would likely need to be > vmalloc/vfree Fair point! Pranith, Romanov, if you would like part of RCU that is less touchy about random hacking, this would be a good place to start. Scripts in tools/testing/selftests/rcutorture/bin do care about some of the format, but the variable-length portion generated by cur_ops->stats() is as far as I know only parsed by human eyes. Thanx, Paul