eal/windows: fix default thread priority

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: 53ffd9f080 ("eal/windows: add minimum viable code")
Cc: stable@dpdk.org

Reported-by: Odi Assli <odia@nvidia.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
This commit is contained in:
Tal Shnaiderman 2021-02-18 13:40:58 +02:00 committed by Thomas Monjalon
parent e863fe3a13
commit 16afcbfa30
2 changed files with 4 additions and 4 deletions

View File

@ -134,8 +134,8 @@ eal_thread_create(pthread_t *thread)
if (!th) if (!th)
return -1; return -1;
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(th, THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(th, THREAD_PRIORITY_NORMAL);
return 0; return 0;
} }

View File

@ -137,8 +137,8 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc, hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
args, 0, (LPDWORD)threadid); args, 0, (LPDWORD)threadid);
if (hThread) { if (hThread) {
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
} }
return ((hThread != NULL) ? 0 : E_FAIL); return ((hThread != NULL) ? 0 : E_FAIL);
} }