[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1003061445490.31447@localhost.localdomain>
Date: Sat, 6 Mar 2010 14:52:55 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Joe Perches <joe@...ches.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Nick Andrew <nick@...k-andrew.net>,
linux-kernel@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
netdev@...r.kernel.org
Subject: Re: [RESEND PATCH 0/2] Make functions of dev_<level> macros, recursive
vsnprintf
On Sat, 6 Mar 2010, Joe Perches wrote:
>
> Maybe limit the %pV recursion depth to 1 with something like:
> (in vsprintf.c: pointer() )
Nope. Think about concurrent users.
The thing is, you have to hide it in local storage. We could make it
thread-local (not cpu-local), but even that interacts badly with
interrupts.
The only really workable approach would be to have a stack slot that is
created by the externally visible routines (and initialized to zero), and
those then passe the address of that as an argument to the lower levels,
and then the recursion happens entirely within those lower level functions
that update the value.
So it's doable, it's just not pretty.
> > and I'd also love to see some actual numbers of > > how deep the vsnprintf stack frame is, but I don't see how to do the
> > first, and I'm hoping the second isn't too horrible.
>
> I believe it's the arguments, a long long, a couple of pointers,
> and a struct printf_spec. Not too bad.
I'm not convinced. We pass that 'printf_spec' around a lot, including
nesting. Not as a pointer, either.
(Bjorn Helgaas has a patch that gets rid of _some_ of the stack usage, but
not nearly all).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists