From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with SMTP id 646BB6B002A for ; Tue, 17 May 2011 18:17:37 -0400 (EDT) Subject: Re: [PATCH 2/3] printk: Add %ptc to safely print a task's comm From: Joe Perches In-Reply-To: <4DD2F0E2.10100@gmail.com> References: <1305665263-20933-1-git-send-email-john.stultz@linaro.org> <1305665263-20933-3-git-send-email-john.stultz@linaro.org> <4DD2EBAB.5080004@gmail.com> <1305669150.1722.83.camel@Joe-Laptop> <4DD2F0E2.10100@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 17 May 2011 15:17:34 -0700 Message-ID: <1305670654.1722.94.camel@Joe-Laptop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Jiri Slaby Cc: John Stultz , LKML , Michal Nazarewicz , Andy Whitcroft , KOSAKI Motohiro , David Rientjes , Dave Hansen , Andrew Morton , linux-mm@kvack.org On Wed, 2011-05-18 at 00:04 +0200, Jiri Slaby wrote: > On 05/17/2011 11:52 PM, Joe Perches wrote: > > On Tue, 2011-05-17 at 23:42 +0200, Jiri Slaby wrote: > >> On 05/17/2011 10:47 PM, John Stultz wrote: > >>> Accessing task->comm requires proper locking. However in the past > >>> access to current->comm could be done without locking. This > >>> is no longer the case, so all comm access needs to be done > >>> while holding the comm_lock. > >>> +static noinline_for_stack > >> With my setup, the code below inlined will use 32 bytes of stack. The > >> same as %pK case. Uninlined it obviously eats "only" 8 bytes for IP. > > The idea is to avoid excess stack consumption for things like: > > struct va_format vaf; > > const char *fmt = "some format with %ptc"; > > vaf.fmt = fmt; > > vaf.va = &va_list; > > printk("some format with %pV\n", &vaf); > There is no way how can noinline_for_stack for task_comm_string lower > the stack usage here, right? Note that it adds no more requirements to > the stack than there were before. Simply because there are no buffers on > the stack in task_comm_string. Isn't flags always on stack in function pointer if task_comm_string were inlined? I believe gcc isn't too good about reusing stack for blocks void foo(args) { if (bar) { long baz; ... } else int baz; ... } I believe gcc still creates 2 separate baz vars on foo's stack. > If nothing, it saves 100 bytes of .text. Submit patches to vsprintf for all the cases you think appropriate. > thanks, cheers, Joe -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org