[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-kernel
Subject: Re: random.c changes for sparse irq_desc are crap
From: Matt Mackall <mpm () selenic ! com>
Date: 2008-12-31 23:40:26
Message-ID: 1230766826.19620.150.camel () calx
[Download RAW message or body]
On Wed, 2008-12-31 at 15:07 -0800, Yinghai Lu wrote:
> Matt Mackall wrote:
> > I just noticed you merged a change that pointlessly converts two
> > random.c functions into ugly random.h inlines without going through the
> > maintainer.
> >
> > I also don't like the look of the newly-introduced sparse variants of
> > these functions. Failure to find an irq descriptor in
> > get_timer_rand_state is a BUG_ON should-never-happen sort of condition,
> > not something to silently ignore. Letting the code try to dereference
> > NULL is preferred here: we'll actually be able to find and fix the
> > broken driver that's throwing around meaningless irq vectors.
> >
> > Throwing away the timer_state pointer in the set_timer_rand_state
> > function is similarly bogus in addition to being a memory leak.
> >
> > Please fix this up.
> >
>
> want something like this?
Not quite.
First, please turn these back into normal functions in random.c.
Inlining functions is generally discouraged these days unless you have a
good reason and numbers to back it up.
Second, as I tried to explain above, BUG_ON(!desc) is doing very little
that the subsequent desc->timer_rand_state wouldn't already do
(generating a traceback). In cases where dereferencing NULL should never
happen, it's preferable to not add the extra check and just let the oops
happen. We'll still get a backtrace if anything ever goes wrong, but we
won't have wasted any code space or CPU cycles when it doesn't.
--
Mathematics is the supreme nostalgia of our time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic