Skip to content

Commit 8f6afbb

Browse files
committed
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 <[email protected]>
1 parent b8b46b2 commit 8f6afbb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

orte/mca/rtc/hwloc/rtc_hwloc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,10 @@ static int find_hole(orte_rtc_hwloc_vm_hole_kind_t hkind,
580580
return use_hole(0, begin, addrp, size);
581581

582582
case VM_HOLE_AFTER_HEAP:
583-
if (prevmkind == VM_MAP_HEAP) {
583+
if (prevmkind == VM_MAP_HEAP && mkind != VM_MAP_HEAP) {
584+
/* only use HEAP when there's no other HEAP after it
585+
* (there can be several of them consecutively).
586+
*/
584587
fclose(file);
585588
return use_hole(prevend, begin-prevend, addrp, size);
586589
}

0 commit comments

Comments
 (0)