Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_IOPRIO_H
0003 #define _UAPI_LINUX_IOPRIO_H
0004 
0005 /*
0006  * Gives us 8 prio classes with 13-bits of data for each class
0007  */
0008 #define IOPRIO_CLASS_SHIFT  13
0009 #define IOPRIO_CLASS_MASK   0x07
0010 #define IOPRIO_PRIO_MASK    ((1UL << IOPRIO_CLASS_SHIFT) - 1)
0011 
0012 #define IOPRIO_PRIO_CLASS(ioprio)   \
0013     (((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
0014 #define IOPRIO_PRIO_DATA(ioprio)    ((ioprio) & IOPRIO_PRIO_MASK)
0015 #define IOPRIO_PRIO_VALUE(class, data)  \
0016     ((((class) & IOPRIO_CLASS_MASK) << IOPRIO_CLASS_SHIFT) | \
0017      ((data) & IOPRIO_PRIO_MASK))
0018 
0019 /*
0020  * These are the io priority groups as implemented by the BFQ and mq-deadline
0021  * schedulers. RT is the realtime class, it always gets premium service. For
0022  * ATA disks supporting NCQ IO priority, RT class IOs will be processed using
0023  * high priority NCQ commands. BE is the best-effort scheduling class, the
0024  * default for any process. IDLE is the idle scheduling class, it is only
0025  * served when no one else is using the disk.
0026  */
0027 enum {
0028     IOPRIO_CLASS_NONE,
0029     IOPRIO_CLASS_RT,
0030     IOPRIO_CLASS_BE,
0031     IOPRIO_CLASS_IDLE,
0032 };
0033 
0034 /*
0035  * The RT and BE priority classes both support up to 8 priority levels.
0036  */
0037 #define IOPRIO_NR_LEVELS    8
0038 #define IOPRIO_BE_NR        IOPRIO_NR_LEVELS
0039 
0040 enum {
0041     IOPRIO_WHO_PROCESS = 1,
0042     IOPRIO_WHO_PGRP,
0043     IOPRIO_WHO_USER,
0044 };
0045 
0046 /*
0047  * Fallback BE priority level.
0048  */
0049 #define IOPRIO_NORM 4
0050 #define IOPRIO_BE_NORM  IOPRIO_NORM
0051 
0052 #endif /* _UAPI_LINUX_IOPRIO_H */