1
1

rtc/hwloc/shmem: fix "heap" hole search kind

There can be multiple [heap] consecutively in proc/<pid>/maps,
and there's no room between them.
Don't use a hole after the first [heap] is there's another [heap]
immediately after it.

This code would fail to find the last [heap] if there were multiple
[heap] interleaved with non-heap VMA, but our kind "after heap"
wouldn't be meaningful anymore anyway.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
Этот коммит содержится в:
Brice Goglin 2017-08-21 15:42:20 +02:00
родитель b8b46b253b
Коммит 8f6afbb641

Просмотреть файл

@ -580,7 +580,10 @@ static int find_hole(orte_rtc_hwloc_vm_hole_kind_t hkind,
return use_hole(0, begin, addrp, size);
case VM_HOLE_AFTER_HEAP:
if (prevmkind == VM_MAP_HEAP) {
if (prevmkind == VM_MAP_HEAP && mkind != VM_MAP_HEAP) {
/* only use HEAP when there's no other HEAP after it
* (there can be several of them consecutively).
*/
fclose(file);
return use_hole(prevend, begin-prevend, addrp, size);
}