Skip to contentSkip to conversation

eal/windows: fix default thread priority

PATCH Applied Tal Shnaiderman 3 participants 4 messages Feb 18, 2021 – Mar 16, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 53ffd9f080f ("eal/windows: add minimum viable code")
---
 lib/librte_eal/windows/eal_thread.c      | 4 ++--
 lib/librte_eal/windows/include/pthread.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/windows/eal_thread.c +2 -2
index 908e726d16..9c3f6d69fd 100644
@@ -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;
 }
lib/librte_eal/windows/include/pthread.h +2 -2
index fb11a07ce6..9aeab1fa70 100644
@@ -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);
 }
Signature · 1 line
2.16.1.windows.4
#1 lore raw
Quoted 59 lines

Subject: [dpdk-dev] [PATCH] 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 53ffd9f080f ("eal/windows: add minimum viable code")
---
 lib/librte_eal/windows/eal_thread.c      | 4 ++--
 lib/librte_eal/windows/include/pthread.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/windows/eal_thread.c +2 -2
index 908e726d16..9c3f6d69fd 100644
@@ -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;
 }
lib/librte_eal/windows/include/pthread.h +0 -2
index fb11a07ce6..9aeab1fa70 100644
@@ -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);

lib/librte_eal/windows/include/pthread.h +1 -0
+		SetPriorityClass(GetCurrentProcess(),

NORMAL_PRIORITY_CLASS);

lib/librte_eal/windows/include/pthread.h +1 -1
+		SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
 	}
 	return ((hThread != NULL) ? 0 : E_FAIL);  }
--
Quoted 1 line

2.16.1.windows.4

Hi,

Any comments on the patch or can it be Acked as was discussed in the community call?

Acked-by on v1 1/1
#2 lore raw
In reply to Tal Shnaiderman

2021-02-18 13:40 (UTC+0200), Tal Shnaiderman:

Quoted 13 lines

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 53ffd9f080f ("eal/windows: add minimum viable code")
Quoted 6 lines
---
 lib/librte_eal/windows/eal_thread.c      | 4 ++--
 lib/librte_eal/windows/include/pthread.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
#3 lore raw

09/03/2021 22:44, Dmitry Kozlyuk:

Quoted 10 lines

2021-02-18 13:40 (UTC+0200), Tal Shnaiderman:

Quoted 9 lines

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.

Quoted 8 lines
Quoted 6 lines

Bugzilla ID: 600

Fixes 53ffd9f080f ("eal/windows: add minimum viable code")

Applied, thanks