mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
e70344c059
The default IO priority is the best effort (BE) class with the normal priority level IOPRIO_NORM (4). However, get_task_ioprio() returns IOPRIO_CLASS_NONE/IOPRIO_NORM as the default priority and get_current_ioprio() returns IOPRIO_CLASS_NONE/0. Let's be consistent with the defined default and have both of these functions return the default priority IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM) when the user did not define another default IO priority for the task. In include/uapi/linux/ioprio.h, introduce the IOPRIO_BE_NORM macro as an alias to IOPRIO_NORM to clarify that this default level applies to the BE priotity class. In include/linux/ioprio.h, define the macro IOPRIO_DEFAULT as IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_BE_NORM) and use this new macro when setting a priority to the default. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Link: https://lore.kernel.org/r/20210811033702.368488-7-damien.lemoal@wdc.com [axboe: drop unnecessary lightnvm change] Signed-off-by: Jens Axboe <axboe@kernel.dk>
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
#ifndef _UAPI_LINUX_IOPRIO_H
|
|
#define _UAPI_LINUX_IOPRIO_H
|
|
|
|
/*
|
|
* Gives us 8 prio classes with 13-bits of data for each class
|
|
*/
|
|
#define IOPRIO_CLASS_SHIFT 13
|
|
#define IOPRIO_CLASS_MASK 0x07
|
|
#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
|
|
|
|
#define IOPRIO_PRIO_CLASS(ioprio) \
|
|
(((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
|
|
#define IOPRIO_PRIO_DATA(ioprio) ((ioprio) & IOPRIO_PRIO_MASK)
|
|
#define IOPRIO_PRIO_VALUE(class, data) \
|
|
((((class) & IOPRIO_CLASS_MASK) << IOPRIO_CLASS_SHIFT) | \
|
|
((data) & IOPRIO_PRIO_MASK))
|
|
|
|
/*
|
|
* These are the io priority groups as implemented by the BFQ and mq-deadline
|
|
* schedulers. RT is the realtime class, it always gets premium service. For
|
|
* ATA disks supporting NCQ IO priority, RT class IOs will be processed using
|
|
* high priority NCQ commands. BE is the best-effort scheduling class, the
|
|
* default for any process. IDLE is the idle scheduling class, it is only
|
|
* served when no one else is using the disk.
|
|
*/
|
|
enum {
|
|
IOPRIO_CLASS_NONE,
|
|
IOPRIO_CLASS_RT,
|
|
IOPRIO_CLASS_BE,
|
|
IOPRIO_CLASS_IDLE,
|
|
};
|
|
|
|
/*
|
|
* The RT and BE priority classes both support up to 8 priority levels.
|
|
*/
|
|
#define IOPRIO_NR_LEVELS 8
|
|
#define IOPRIO_BE_NR IOPRIO_NR_LEVELS
|
|
|
|
enum {
|
|
IOPRIO_WHO_PROCESS = 1,
|
|
IOPRIO_WHO_PGRP,
|
|
IOPRIO_WHO_USER,
|
|
};
|
|
|
|
/*
|
|
* Fallback BE priority level.
|
|
*/
|
|
#define IOPRIO_NORM 4
|
|
#define IOPRIO_BE_NORM IOPRIO_NORM
|
|
|
|
#endif /* _UAPI_LINUX_IOPRIO_H */
|