[dpdk-dev] [PATCH v16 2/9] eal: add thread attributes
Narcisa Ana Maria Vasile
navasile at linux.microsoft.com
Tue Nov 9 02:59:23 CET 2021
On Tue, Oct 12, 2021 at 06:12:21PM +0200, Thomas Monjalon wrote:
> 09/10/2021 09:41, Narcisa Ana Maria Vasile:
> > From: Narcisa Vasile <navasile at microsoft.com>
> >
> > 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_CRITICAL
>
> It 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.
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
>
> > Affinity is described by the rte_cpuset_t type.
> >
> > An rte_thread_attr_t object can be set to the default values
> > by calling rte_thread_attr_init().
> >
> > Signed-off-by: Narcisa Vasile <navasile at microsoft.com>
> [...]
> > lib/eal/common/rte_thread.c | 46 ++++++++++++++++++
> > lib/eal/windows/rte_thread.c | 44 +++++++++++++++++
>
> These 2 files look like code duplication.
>
>
More information about the dev
mailing list