Subject: Re: device tree traversal
To: matthew green <>
From: Jachym Holecek <>
List: tech-kern
Date: 07/03/2006 15:23:03
# matthew green 2006-07-03:
>    	/* Allocate recursion context of max depth 16, topdown dir. */
>    	di = device_iterator_alloc(16, DIF_WAITOK | DIF_TOPDOWN);
> why have this '16' limit at all?  i don't see why it's necessary
> or even a good idea.

The idea was to avoid any allocation in device_iterator_foreach(),
so that it could be used from interrupt context if needed (ie.
in config_{de,}activate()) -- we probably want to avoid allocations
within hardintrs.

I can see two possibilities:

  1. Just use realloc (we already cache dvi_flags, so we could pass
     M_{WAITOK,NOWAIT} correctly).

  2. Be aware of maximum device tree depth, allocate say 1.5 of that
     to be safe.

What do you think?

	-- Jachym