thread_set_smt_priority or thread_read_smt_priority System Call

Purpose

Sets or reads the current simultaneous multithreading (SMT) thread priority for a user-thread.

Syntax

#include <sys/errno.h>
#include <sys/thread.h>
#include <sys/processor.h>

int thread_set_smt_priority ( Priority )
smt_thread_priority_t Priority;

#include <sys/errno.h>
#include <sys/thread.h>
#include <sys/processor.h>

smt_thread_priority_t thread_read_smt_priority ( )

Description

The SMT thread priority that is associated with a logical CPU, SMT hardware thread, controls the relative priority of the logical CPU in relation to the other logical CPUs on the same processor core. The relative priority between the SMT hardware threads on a processor core determines how decode cycles are granted to each SMT hardware thread. The SMT thread priority can be used to cause a particular application thread to be favored over other application threads that are running on the other SMT hardware threads in the same processor core. It is done by increasing the SMT thread priority of the logical CPU the application is running on, or by lowering the SMT thread priority of the application threads that are running on the other logical CPUs associated with the same processor core.

The thread_set_smt_priority and thread_read_smt_priority system calls provide a way to register and read back the current SMT thread priority on a per process-thread basis.
Note:

These interfaces are not supported on some processor architectures.

If the process-thread is dispatched to a logical CPU that is running in non-SMT mode, the SMT thread priority level has no effect.

Callers of the thread_set_smt_priority system call with normal user-level privileges can set their SMT thread priority level to one of the following levels:
  • LOW
  • MEDIUM LOW
  • NORMAL
Callers that have RBAC PV_PROC_VARS privilege can set their priority level to one of the following levels:
  • VERY LOW
  • LOW
  • MEDIUM LOW
  • NORMAL
  • MEDIUM HIGH
  • HIGH
The default thread priority level is NORMAL.
Note: The only supported means for altering the SMT thread priority level is by using the thread_set_smt_priority system call. If an alternative means of setting the SMT priority is used, the kernel does not know the process-thread’s current SMT priority level, and overwrites the required SMT priority level without restoring it.

The thread_read_smt_priority system call returns the current SMT priority level that is registered by the process thread. If the process thread did not register a required SMT priority level, then the default priority level of NORMAL is returned.

Parameters

Item Description
Priority Used to specify one of the following parameters:
  • T_VERYLOW_SMT_PRI
  • T_LOW_SMT_PRI
  • T_MEDIUMLOW_SMT_PRI
  • T_NORMAL_SMT_PRI
  • T_MEDIUMHIGH_SMT_PRI
  • T_HIGH_SMT_PRI

Execution Environment

The thread_read_smt_priority and thread_set_smt_priority system calls can be called from the process environment only.

Return Values

On successful completion, the thread_set_smt_priority system call returns 0. Otherwise, -1 is returned and the errno global variable is set to indicate the error.

On successful completion, the thread_read_smt_priority system call returns the current required SMT priority. Otherwise, -1 is returned and the errno global variable is set to indicate the error.

Error Codes

Item Description
EPERM The process attempted to set the SMT thread priority level to a value other than T_LOW_SMT_PRI, T_MEDIUMLOW_SMT_PRI, or T_NORMAL_SMT_PRI and does not have the necessary privileges.
EINVAL The required priority value that is specified is invalid.
ENOSYS SMT thread priority level manipulation is not supported on this system.