Re: Worst recursion in the kernel

From: David Hinds
Date: Wed Dec 03 2003 - 18:13:06 EST

On Wed, Dec 03, 2003 at 08:04:40PM +0100, Jörn Engel wrote:
> You are right, verify_cis_cache() does not belong into the list.
> Gotta see where that bug comes from. set_cis_map() is correct,
> though. It does call validate_mem(), at least in my copy of
> 2.6.0-test11:

Oh, so it does; I was looking at the older version I wrote.

> I have no better alternative availlable right now, but there must be
> another way. Maybe something like this:
> read_cis_mem() {
> if (__read_cis_mem() != -EAGAIN)
> return;
> validate_mem();
> __read_cis_mem();
> }

The issue is that validate_mem() doesn't need to use read_cis_mem's
functionality directly (so it can't just be modified to use the __*
form). It calls other stuff, which calls other stuff, which
eventually calls read_cis_mem(), and all that other stuff is used by
other callers. So there isn't an obvious place to insert this

> Not sure about you, but it would make my program much happier. If you
> look at the relevant part of the call graph (below), you will notice
> that inv_probe() alone is already recursive. Having multiple
> recursions to worry about in the same function is where the problem
> stops being difficult and becomes impossible.

inv_probe() is pretty comprehensible, it calls itself directly, in
order to traverse a short linked list from tail to head.

-- Dave
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at