~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/ioprio.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/uapi/linux/ioprio.h (Version linux-6.12-rc7) and /include/uapi/linux/ioprio.h (Version linux-6.8.12)


  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux      1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 #ifndef _UAPI_LINUX_IOPRIO_H                        2 #ifndef _UAPI_LINUX_IOPRIO_H
  3 #define _UAPI_LINUX_IOPRIO_H                        3 #define _UAPI_LINUX_IOPRIO_H
  4                                                     4 
  5 #include <linux/stddef.h>                           5 #include <linux/stddef.h>
  6 #include <linux/types.h>                            6 #include <linux/types.h>
  7                                                     7 
  8 /*                                                  8 /*
  9  * Gives us 8 prio classes with 13-bits of dat      9  * Gives us 8 prio classes with 13-bits of data for each class
 10  */                                                10  */
 11 #define IOPRIO_CLASS_SHIFT      13                 11 #define IOPRIO_CLASS_SHIFT      13
 12 #define IOPRIO_NR_CLASSES       8                  12 #define IOPRIO_NR_CLASSES       8
 13 #define IOPRIO_CLASS_MASK       (IOPRIO_NR_CLA     13 #define IOPRIO_CLASS_MASK       (IOPRIO_NR_CLASSES - 1)
 14 #define IOPRIO_PRIO_MASK        ((1UL << IOPRI     14 #define IOPRIO_PRIO_MASK        ((1UL << IOPRIO_CLASS_SHIFT) - 1)
 15                                                    15 
 16 #define IOPRIO_PRIO_CLASS(ioprio)       \          16 #define IOPRIO_PRIO_CLASS(ioprio)       \
 17         (((ioprio) >> IOPRIO_CLASS_SHIFT) & IO     17         (((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
 18 #define IOPRIO_PRIO_DATA(ioprio)        ((iopr     18 #define IOPRIO_PRIO_DATA(ioprio)        ((ioprio) & IOPRIO_PRIO_MASK)
 19                                                    19 
 20 /*                                                 20 /*
 21  * These are the io priority classes as implem     21  * These are the io priority classes as implemented by the BFQ and mq-deadline
 22  * schedulers. RT is the realtime class, it al     22  * schedulers. RT is the realtime class, it always gets premium service. For
 23  * ATA disks supporting NCQ IO priority, RT cl     23  * ATA disks supporting NCQ IO priority, RT class IOs will be processed using
 24  * high priority NCQ commands. BE is the best-     24  * high priority NCQ commands. BE is the best-effort scheduling class, the
 25  * default for any process. IDLE is the idle s     25  * default for any process. IDLE is the idle scheduling class, it is only
 26  * served when no one else is using the disk.      26  * served when no one else is using the disk.
 27  */                                                27  */
 28 enum {                                             28 enum {
 29         IOPRIO_CLASS_NONE       = 0,               29         IOPRIO_CLASS_NONE       = 0,
 30         IOPRIO_CLASS_RT         = 1,               30         IOPRIO_CLASS_RT         = 1,
 31         IOPRIO_CLASS_BE         = 2,               31         IOPRIO_CLASS_BE         = 2,
 32         IOPRIO_CLASS_IDLE       = 3,               32         IOPRIO_CLASS_IDLE       = 3,
 33                                                    33 
 34         /* Special class to indicate an invali     34         /* Special class to indicate an invalid ioprio value */
 35         IOPRIO_CLASS_INVALID    = 7,               35         IOPRIO_CLASS_INVALID    = 7,
 36 };                                                 36 };
 37                                                    37 
 38 /*                                                 38 /*
 39  * The RT and BE priority classes both support     39  * The RT and BE priority classes both support up to 8 priority levels that
 40  * can be specified using the lower 3-bits of      40  * can be specified using the lower 3-bits of the priority data.
 41  */                                                41  */
 42 #define IOPRIO_LEVEL_NR_BITS            3          42 #define IOPRIO_LEVEL_NR_BITS            3
 43 #define IOPRIO_NR_LEVELS                (1 <<      43 #define IOPRIO_NR_LEVELS                (1 << IOPRIO_LEVEL_NR_BITS)
 44 #define IOPRIO_LEVEL_MASK               (IOPRI     44 #define IOPRIO_LEVEL_MASK               (IOPRIO_NR_LEVELS - 1)
 45 #define IOPRIO_PRIO_LEVEL(ioprio)       ((iopr     45 #define IOPRIO_PRIO_LEVEL(ioprio)       ((ioprio) & IOPRIO_LEVEL_MASK)
 46                                                    46 
 47 #define IOPRIO_BE_NR                    IOPRIO     47 #define IOPRIO_BE_NR                    IOPRIO_NR_LEVELS
 48                                                    48 
 49 /*                                                 49 /*
 50  * Possible values for the "which" argument of     50  * Possible values for the "which" argument of the ioprio_get() and
 51  * ioprio_set() system calls (see "man ioprio_     51  * ioprio_set() system calls (see "man ioprio_set").
 52  */                                                52  */
 53 enum {                                             53 enum {
 54         IOPRIO_WHO_PROCESS = 1,                    54         IOPRIO_WHO_PROCESS = 1,
 55         IOPRIO_WHO_PGRP,                           55         IOPRIO_WHO_PGRP,
 56         IOPRIO_WHO_USER,                           56         IOPRIO_WHO_USER,
 57 };                                                 57 };
 58                                                    58 
 59 /*                                                 59 /*
 60  * Fallback BE class priority level.               60  * Fallback BE class priority level.
 61  */                                                61  */
 62 #define IOPRIO_NORM     4                          62 #define IOPRIO_NORM     4
 63 #define IOPRIO_BE_NORM  IOPRIO_NORM                63 #define IOPRIO_BE_NORM  IOPRIO_NORM
 64                                                    64 
 65 /*                                                 65 /*
 66  * The 10 bits between the priority class and      66  * The 10 bits between the priority class and the priority level are used to
 67  * optionally define I/O hints for any combina     67  * optionally define I/O hints for any combination of I/O priority class and
 68  * level. Depending on the kernel configuratio     68  * level. Depending on the kernel configuration, I/O scheduler being used and
 69  * the target I/O device being used, hints can     69  * the target I/O device being used, hints can influence how I/Os are processed
 70  * without affecting the I/O scheduling orderi     70  * without affecting the I/O scheduling ordering defined by the I/O priority
 71  * class and level.                                71  * class and level.
 72  */                                                72  */
 73 #define IOPRIO_HINT_SHIFT               IOPRIO     73 #define IOPRIO_HINT_SHIFT               IOPRIO_LEVEL_NR_BITS
 74 #define IOPRIO_HINT_NR_BITS             10         74 #define IOPRIO_HINT_NR_BITS             10
 75 #define IOPRIO_NR_HINTS                 (1 <<      75 #define IOPRIO_NR_HINTS                 (1 << IOPRIO_HINT_NR_BITS)
 76 #define IOPRIO_HINT_MASK                (IOPRI     76 #define IOPRIO_HINT_MASK                (IOPRIO_NR_HINTS - 1)
 77 #define IOPRIO_PRIO_HINT(ioprio)        \          77 #define IOPRIO_PRIO_HINT(ioprio)        \
 78         (((ioprio) >> IOPRIO_HINT_SHIFT) & IOP     78         (((ioprio) >> IOPRIO_HINT_SHIFT) & IOPRIO_HINT_MASK)
 79                                                    79 
 80 /*                                                 80 /*
 81  * I/O hints.                                      81  * I/O hints.
 82  */                                                82  */
 83 enum {                                             83 enum {
 84         /* No hint */                              84         /* No hint */
 85         IOPRIO_HINT_NONE = 0,                      85         IOPRIO_HINT_NONE = 0,
 86                                                    86 
 87         /*                                         87         /*
 88          * Device command duration limits: ind     88          * Device command duration limits: indicate to the device a desired
 89          * duration limit for the commands tha     89          * duration limit for the commands that will be used to process an I/O.
 90          * These will currently only be effect     90          * These will currently only be effective for SCSI and ATA devices that
 91          * support the command duration limits     91          * support the command duration limits feature. If this feature is
 92          * enabled, then the commands issued t     92          * enabled, then the commands issued to the device to process an I/O with
 93          * one of these hints set will have th     93          * one of these hints set will have the duration limit index (dld field)
 94          * set to the value of the hint.           94          * set to the value of the hint.
 95          */                                        95          */
 96         IOPRIO_HINT_DEV_DURATION_LIMIT_1 = 1,      96         IOPRIO_HINT_DEV_DURATION_LIMIT_1 = 1,
 97         IOPRIO_HINT_DEV_DURATION_LIMIT_2 = 2,      97         IOPRIO_HINT_DEV_DURATION_LIMIT_2 = 2,
 98         IOPRIO_HINT_DEV_DURATION_LIMIT_3 = 3,      98         IOPRIO_HINT_DEV_DURATION_LIMIT_3 = 3,
 99         IOPRIO_HINT_DEV_DURATION_LIMIT_4 = 4,      99         IOPRIO_HINT_DEV_DURATION_LIMIT_4 = 4,
100         IOPRIO_HINT_DEV_DURATION_LIMIT_5 = 5,     100         IOPRIO_HINT_DEV_DURATION_LIMIT_5 = 5,
101         IOPRIO_HINT_DEV_DURATION_LIMIT_6 = 6,     101         IOPRIO_HINT_DEV_DURATION_LIMIT_6 = 6,
102         IOPRIO_HINT_DEV_DURATION_LIMIT_7 = 7,     102         IOPRIO_HINT_DEV_DURATION_LIMIT_7 = 7,
103 };                                                103 };
104                                                   104 
105 #define IOPRIO_BAD_VALUE(val, max) ((val) < 0     105 #define IOPRIO_BAD_VALUE(val, max) ((val) < 0 || (val) >= (max))
106                                                   106 
107 /*                                                107 /*
108  * Return an I/O priority value based on a cla    108  * Return an I/O priority value based on a class, a level and a hint.
109  */                                               109  */
110 static __always_inline __u16 ioprio_value(int     110 static __always_inline __u16 ioprio_value(int prioclass, int priolevel,
111                                           int     111                                           int priohint)
112 {                                                 112 {
113         if (IOPRIO_BAD_VALUE(prioclass, IOPRIO    113         if (IOPRIO_BAD_VALUE(prioclass, IOPRIO_NR_CLASSES) ||
114             IOPRIO_BAD_VALUE(priolevel, IOPRIO    114             IOPRIO_BAD_VALUE(priolevel, IOPRIO_NR_LEVELS) ||
115             IOPRIO_BAD_VALUE(priohint, IOPRIO_    115             IOPRIO_BAD_VALUE(priohint, IOPRIO_NR_HINTS))
116                 return IOPRIO_CLASS_INVALID <<    116                 return IOPRIO_CLASS_INVALID << IOPRIO_CLASS_SHIFT;
117                                                   117 
118         return (prioclass << IOPRIO_CLASS_SHIF    118         return (prioclass << IOPRIO_CLASS_SHIFT) |
119                 (priohint << IOPRIO_HINT_SHIFT    119                 (priohint << IOPRIO_HINT_SHIFT) | priolevel;
120 }                                                 120 }
121                                                   121 
122 #define IOPRIO_PRIO_VALUE(prioclass, priolevel    122 #define IOPRIO_PRIO_VALUE(prioclass, priolevel)                 \
123         ioprio_value(prioclass, priolevel, IOP    123         ioprio_value(prioclass, priolevel, IOPRIO_HINT_NONE)
124 #define IOPRIO_PRIO_VALUE_HINT(prioclass, prio    124 #define IOPRIO_PRIO_VALUE_HINT(prioclass, priolevel, priohint)  \
125         ioprio_value(prioclass, priolevel, pri    125         ioprio_value(prioclass, priolevel, priohint)
126                                                   126 
127 #endif /* _UAPI_LINUX_IOPRIO_H */                 127 #endif /* _UAPI_LINUX_IOPRIO_H */
128                                                   128 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php