> + int try_rescan = 0;
Oh my mistake, sorry. It was so quick draft...
Of course try_rescan must be not 0 before the first scan:
try_rescan = 1;
> + ReScan:
> tmpsearch.space = length;
> tmp = RB_NFIND(uvm_tree_space, &map->rb_space, &tmpsearch);
> if (tmp == NULL)
> goto error;
>
> for (/* tmp */; tmp;
> tmp = RB_NEXT(uvm_tree_space, &map->rb_space, tmp)) {
> for (entry = tmp; entry; entry = entry->next_with_equal_space)
{
> /* restore hint before each test */
> hint = saved_hint;
> if (hint < entry->end)
> hint = entry->end;
> if (uvm_map_spacefits(map, &hint, length,
entry->next,
> uoffset, align))
> goto found;
> }
> }
> + if (try_rescan)
> + try_rescan = 0;
> + saved_hint = map->min_offset;
> + goto ReScan;
> + }
--
antonvm