Skip to content

Commit d3e54cb

Browse files
committed
util: Handle signal interrupts in uffd memory monitor
If unhandled, a signal such as SIGPROF sent to the thread that is running ofi_uffd_handler will cause it to exit early. Signed-off-by: Jianxin Xiong <[email protected]>
1 parent b9a8133 commit d3e54cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

prov/util/src/uffd_mem_monitor.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ static void *ofi_uffd_handler(void *arg)
108108

109109
for (;;) {
110110
ret = poll(fds, 2, -1);
111+
if (ret < 0 && errno == EINTR)
112+
continue;
113+
111114
if (ret < 0 || fds[1].revents)
112115
break;
113116

@@ -117,7 +120,7 @@ static void *ofi_uffd_handler(void *arg)
117120
if (ret != sizeof(msg)) {
118121
pthread_mutex_unlock(&mm_lock);
119122
pthread_rwlock_unlock(&mm_list_rwlock);
120-
if (errno != EAGAIN)
123+
if (errno != EAGAIN && errno != EINTR)
121124
break;
122125
continue;
123126
}

0 commit comments

Comments
 (0)