[PATCH v3 1/2] eal: get/set thread priority per thread identifier
Stephen Hemminger
stephen at networkplumber.org
Thu May 26 17:21:27 CEST 2022
On Wed, 25 May 2022 23:29:57 -0700
Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
> On Tue, May 24, 2022 at 07:51:05AM -0700, Stephen Hemminger wrote:
> > On Tue, 24 May 2022 04:08:36 -0700
> > Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
> >
> > > +static int
> > > +thread_map_priority_to_os_value(enum rte_thread_priority eal_pri,
> > > + int *os_pri, int *pol)
> > > +{
> > > + /* Clear the output parameters */
> > > + *os_pri = sched_get_priority_min(SCHED_OTHER) - 1;
> > > + *pol = -1;
> > > +
> > > + switch (eal_pri) {
> > > + case RTE_THREAD_PRIORITY_NORMAL:
> > > + *pol = SCHED_OTHER;
> > > +
> > > + /*
> > > + * Choose the middle of the range to represent
> > > + * the priority 'normal'.
> > > + * On Linux, this should be 0, since both
> > > + * sched_get_priority_min/_max return 0 for SCHED_OTHER.
> > > + */
> > > + *os_pri = (sched_get_priority_min(SCHED_OTHER) +
> > > + sched_get_priority_max(SCHED_OTHER))/2;
> > > + break;
> > > + case RTE_THREAD_PRIORITY_REALTIME_CRITICAL:
> > > + *pol = SCHED_RR;
> > > + *os_pri = sched_get_priority_max(SCHED_RR);
> > > + break;
> >
> > Many people have experimented with realtime priorities with DPDK
> > and Linux, and have never heard of any one not having problems.
> >
> > Recommend that this either be an error add a warning log message
> > that "Setting real time priority may break"
>
> so i went back through the feedback when the priority change was
> originally introduced. you're request was that you didn't want it to be
> possible for realtime priority to be set on linux.
>
> this particular function is just about mapping the abstracted
> representation of realtime priority in eal to the platform specific
> linux representation.
>
> so if you take a look at the other parts of the patch you will notice
> that the rte_thread_set_priority() for linux will in fact fail if you
> try to use realtime priority.
>
> additionally, the unit test exercises that attempting to use realtime
> priority does fail for linux.
>
> take another look and let me know if you don't agree.
>
> thanks
Thanks for clarifying.
Is there any analog for SCHED_DEADLINE worth considering?
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list