[PATCH v3 1/2] eal: get/set thread priority per thread identifier

Stephen Hemminger stephen at networkplumber.org
Tue May 24 16:51:05 CEST 2022


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"



> +	default:
> +		RTE_LOG(DEBUG, EAL, "The requested priority value is invalid.\n");
> +		return EINVAL;
> +	}
> +	return 0;
> +}


More information about the dev mailing list