Re: Setjmp/Longjmp in the kernel?

John W. M. Stevens (john@betelgeuse.us)
Wed, 12 Feb 2003 12:45:01 -0700


On Wed, Feb 12, 2003 at 11:55:32AM +0100, Kasper Dupont wrote:
> Olaf Titz wrote:
> >
> > Not that this matters any bit, but the proper order is of course
> > alloc this
> > alloc that
> > _foo_func()
> > free that
> > free this
> >
> > even if only for aesthetical reasons :-)
> >
> > (with locks, it does matter...)
>
> For locks it is only when you lock the order matters, not when
> you unlock. For allocations there is of course the possibility
> that the first allocation suceeds and the second fails, which
> you must handle in some way.

The usual way is with "pools".

Every resource allocated after a "mark" point gets dumped into
a separate pool, and then when processing returns to the mark
point, the pools are drained, one way or the other.

For locks, the pools are ordered, and you swim backwards through
the pool.

John S.
-
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/