tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Using qsort(3) in the kernel (was: CVS commit: src)

On Sun, 16 Nov 2008 10:11:10 -0800 (PST)
kamel derouiche <> wrote:

> > Our implementation of qsort() uses recursion. That
> > is IMHO a dangerous
> > thing to do in the kernel.
> why that?, can you explain?
The kernel stack is limited in size; if the recursion is too deep, it
can exceed that limit.  It's only safe to do recursion if you can (a)
guarantee the maximum depth; and (b) show that for all uses of this
routine, the total stack consumption will be low enough.

                --Steve Bellovin,

Home | Main Index | Thread Index | Old Index