Re: [dpdk-dev] [PATCH v16 2/9] eal: add thread attributes
From: Thomas Monjalon <hidden>
Date: 2021-11-09 08:27:15
09/11/2021 02:59, Narcisa Ana Maria Vasile:
On Tue, Oct 12, 2021 at 06:12:21PM +0200, Thomas Monjalon wrote:quoted
09/10/2021 09:41, Narcisa Ana Maria Vasile:quoted
From: Narcisa Vasile <redacted> Implement thread attributes for: * thread affinity * thread priority Implement functions for managing thread attributes. Priority is represented through an enum that allows for two levels: - RTE_THREAD_PRIORITY_NORMAL - RTE_THREAD_PRIORITY_REALTIME_CRITICALIt doesn't say how do you translate these priorites in POSIX and win32.I'll send a new version with a better commit message. Thread priorities on both Linux-based and Windows platforms are similarly constructed from a class/policy + priority value. Currently in DPDK, most threads operate at the OS-default priority level but there are cases when increasing the priority is useful. For example, the Mellanox data path acceleration driver requires realtime thread priority. Similarly, some Windows applications will require elevated priority.
It should not. We should not use realtime priority.
For these reasons, EAL will advertise 2 priority levels which are named suggestively
"normal" and "realtime_critical" and are computed as follows:
For Linux and similar platforms:
* EAL "normal" priority corresponds to the (default) SCHED_OTHER policy + a priority value of
(sched_get_priority_min(SCHED_OTHER) + sched_get_priority_max(SCHED_OTHER))/2.
Note that on Linux the resulting priority value will be 0,
in accordance to the docs guidance that mention the value should be 0 for SCHED_OTHER policy.
* EAL "realtime" priority corresponds to the SCHED_RR policy + a priority value of
sched_get_priority_max(SCHED_RR);
For Windows:
* EAL "normal" corresponds to class NORMAL_PRIORITY_CLASS +
priority THREAD_PRIORITY_NORMAL
* EAL "realtime_critical" corresponds to class REALTIME_PRIORITY_CLASS +
priority THREAD_PRIORITY_TIME_CRITICAL