2010/2/26 Theo de Raadt <[email protected]>:
>> But I just want to add POSSIBILITY to change this. Let sysadmin decide
>> that in some case it NEED "shrink randomness", doesn't matter which
>> bugs _may_ will show themselfs.
> No.  We choose to not do that

Ok, I got this. Let it be.

But what about this:
2010/2/26 Otto Moerbeek <[email protected]>:
> On Fri, Feb 26, 2010 at 10:58:09AM +0500, Anton Maksimenkov wrote:
>> I think that if uvm_map_findspace() can't find space from "hint" then
>> it must retry searching _without_ hint (say, setting it to
>> map->min_offset). In that case it may find last free holes and use
>> them.
> Yes, uvm hackers know about this potential problem. But none came up
> with a diff yet.
We can simply achieve this. I can show some idea, let's rewrite my
diff just a little:

+       int try_rescan = 0;
+ 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;
+       }

I think that we may try rescan before the second (unaligned) call, as
showed above. If you think that it must be used only at last try, when
aligned=0, it may be simply added into "if" statement, of course.
--
antonvm

Reply via email to