2010/2/26 Anton Maksimenkov <[email protected]>: >> + ReScan: It might be better solution. As I said to art@, we might generate random exactly in uvm_map_findspace().
The idea might be like this. We don't use uvm_map_hint(). In uvm_map_findspace() we get entry with biggest space. Then we generate random from range 0...MIN(space-length, 256M). Then we search first entry with space >= length+that_random. It surely exists, at least the entry with biggest space. And at the end in uvm_map_findspace() we set *result = entry->start + that_random; And there is some "caveat" - previous algorithm make address constantly grow. Algorithm described above don't do that. But as a bonus it provide more randomization - allocations will always have random gap from others. Previous algorithm set hint = entry->end if hint < entry->end. Second bonus - this approach might provide better performance - we don't need to scan all tree to find entry with entry->end > hint. We just need to find first entry with space >= length+that_random. Of course, when address space become filled more and more then the maximum space might become < 256M. So random range become reduced more and more. But allocations will not fail until there will be at least one entry with space >= length. I think that you'll say that we can't reduce randomization less than, say, 256M - let's not reduce and always generate it from range range 0...256M (or any). So allocations may start to fail earlier. Again, it is quickly to check is there are entry with space >= length+that_random. I can make the diff, if that approach will be decided as "good". -- antonvm
