Skip to content

ioprio_set

Intro

ioprio_set - set the I/O scheduling class and priority of a process

Description

The ioprio_set() system call is used to set the I/O scheduling class and priority of a process, or thread group. The ioprio_set() call takes three parameters: which, who and ioprio and sets the I/O scheduling class and priority of the process specified by which and who to the value specified by ioprio. The class of scheduling is determined by the upper bits of the ioprio argument; the lower bits of ioprio determine the actual priority within the class. The four classes available are IOPRIO_CLASS_RT (real-time class), IOPRIO_CLASS_BE (best effort class), IOPRIO_CLASS_IDLE (idle priority class) and IOPRIO_CLASS_NONE (no class, just the priority).

The ioprio_set() call is advantageous because it allows the user to specify the I/O scheduling class and priority for individual applications, threads or thread-groups which makes it possible to ensure that only certain processes receive the I/O resources they need. However, it is important to remember that using this system call in conjunction with unscheduling classes can have adverse effects on other applications and the overall system performance.

Arguments

  • which: int - Specifies whether to apply the setting to the current process or thread group (0=current, 1=thread group).
  • who: int - Specifies which pid or thread group (tgid) to apply the setting to. Set to 0 for the current thread.
  • ioprio: int - Specifies the I/O scheduling class and priority. The value consists of two parts: the class (the 5 most significant bits, bits 4-0 inclusive), and the priority within the class (the 19 least significant bits).

Available Tags

  • U - Originated from user space (for example, pointer to user space memory used to get it)

Hooks

DoIOPriority

Type

Kprobe

Purpose

To register IOPriority operations.

Example Use Case

ioprio_set() could be used to ensure that specific applications receive a higher priority, or more resources, than others. For example, a multimedia application needs access to the disk more often than an e-mail application, so setting the I/O priority of the multimedia application to a higher level might help improve the performance of that application.

Issues

This system call is sensitive to changes and may have unexpected results or have a performance impact if used indiscriminately. It is important to consider the implications before changing the default I/O scheduling class of a process.

  • ioprio_get() - get the I/O scheduling class and priority of a process

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.