Skip to content

Commit

Permalink
eal/windows: fix default thread priority
Browse files Browse the repository at this point in the history
[ upstream commit 16afcbf ]

The hard-coded thread priority for Windows threads in EAL
is REALTIME_PRIORITY_CLASS/THREAD_PRIORITY_TIME_CRITICAL.

This results in issues with DPDK threads causing OS thread starvation
and eventually a bugcheck.

The fix reduce the thread priority to
NORMAL_PRIORITY_CLASS/THREAD_PRIORITY_NORMAL.

Bugzilla ID: 600
Fixes: 53ffd9f ("eal/windows: add minimum viable code")

Reported-by: Odi Assli <odia@nvidia.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
  • Loading branch information
Tal Shnaiderman authored and steevenlee committed May 8, 2021
1 parent 87af5c7 commit d68bec0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/librte_eal/windows/eal_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ eal_thread_create(pthread_t *thread)
if (!th)
return -1;

SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL);
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(th, THREAD_PRIORITY_NORMAL);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/librte_eal/windows/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
args, 0, (LPDWORD)threadid);
if (hThread) {
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
}
return ((hThread != NULL) ? 0 : E_FAIL);
}
Expand Down

0 comments on commit d68bec0

Please sign in to comment.