os-linux: add initial support for IO priority hints Add initial support for Linux to allow specifying a hint for any priority value. With this change, a priority value becomes the combination of a priority class, a priority level and a hint. The generic os.h ioprio manipulation macros, as well as the os-dragonfly.h ioprio manipulation macros are modified to ignore this hint. For all other OSes that do not support priority classes, priotity hints are ignored and always equal to 0. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Link: https://lore.kernel.org/r/20230721110510.44772-4-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
os-linux: Cleanup IO priority class and value macros In os/os-linux.h, define the ioprio() macro using the already defined IOPRIO_MAX_PRIO macro instead of hard coding the maximum priority value again. Also move the definitions of the ioprio_class() and ioprio() macros before the ioprio_value() function and use ioprio_class() inside ioprio_value_is_class_rt() instead of re-coding the iopriority class extraction again in that function. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Link: https://lore.kernel.org/r/20230721110510.44772-2-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat: Fix ioprio print When using per-priority statistics for workloads using multiple different priority values, the statistics output displays the priority class and value (level) for each set of statistics. However, this is done using linux priority values coding, that is, assuming that the priority level is at most 7 (lower 3-bits). However, this is not always the case for all OSes. E.g. dragonfly allows IO priorities up to a value of 10. Introduce the OS dependent ioprio_class() and ioprio() macros to extract the fields from an ioprio value according to the OS capabilities. A generic definition (always returning 0) for these macros in os/os.h is added and used for all OSes that do not define these macros. The functions show_ddir_status() and add_ddir_status_json() are modified to use these new macros to fix per priority statistics output. The modification includes changes to the loops over the clat_prio array to reduce indentation levels, making the code a little cleaner. Fixes: 692dec0cfb4b ("stat: report clat stats on a per priority granularity") Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Get rid of O_ATOMIC This feature never went upstream on the Linux kernel side, let's just get rid of it. The option is left for now, but we can deprecate that or even probably remove it as it will never had had any effect. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Enable crc32c accelleration for arm64 on OSX Before: jensaxboe@Jenss-MacBook-Pro fio % ./fio --crctest=crc32c crc32c: 440.18 MiB/sec After: ensaxboe@Jenss-MacBook-Pro fio % ./fio --crctest=crc32c crc32c: 23923.00 MiB/sec We know we have it on osx on arm hardware, enabling it is pretty straightforward with that assumption. Signed-off-by: Jens Axboe <axboe@kernel.dk>
cpus_allowed: use __NRPROCESSORS_CONF instead of __SC_NPROCESSORS_ONLN for non-sequential CPU ids When disabling SMT on some systems, the ID of some available CPU may be larger than the value of sysconf(_SC_NPROCESSORS_ONLN). Without this patch, fio complains that the expected CPU ID is invalid. Here's an example from my server: $ ./fio --cpus_allowed=14 --ioengine=libaio --direct=1 --name=test --numjobs=1 --blocksize=128k --iodepth=1 --rw=read --filename=/dev/nvme0n1 fio: CPU 14 too large (max=11) fio: failed parsing cpus_allowed=14 System information: $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 20 On-line CPU(s) list: 0,2,4,6,8,10,12,14,16-19 Off-line CPU(s) list: 1,3,5,7,9,11,13,15 ... Model name: 12th Gen Intel(R) Core(TM) i7-12700 BIOS Model name: 12th Gen Intel(R) Core(TM) i7-12700 ... $ uname -a Linux localhost.localdomain 4.18.0-348.el8.x86_64 #1 SMP Tue Oct 19 15:14:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/redhat-release CentOS Linux release 8.5.2111 $ cat /proc/cmdline BOOT_IMAGE=(hd0,gpt2)/vmlinuz-4.18.0-348.el8.x86_64 root=/dev/mapper/cl-root ro nosmt isolcpus=0,2,4,6,8,10,12,14 crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet $ cat test.c #include <stdio.h> #include <unistd.h> int main(int argc, char *argv[]) { printf("_SC_NPROCESSORS_ONLN=%ld _SC_NPROCESSORS_CONF=%ld\n", sysconf(_SC_NPROCESSORS_ONLN), sysconf(_SC_NPROCESSORS_CONF)); } $ gcc test.c $ ./a.out _SC_NPROCESSORS_ONLN=12 _SC_NPROCESSORS_CONF=20 Signed-off-by: mayuanpeng <mayuanpeng@dapustor.com>
engines/io_uring: set single issuer and defer taskrun If available, set these two flags as well. SINGLE_ISSUER tells the kernel that it can expect that it's just a single task issuing requests, and DEFER_TASKRUN tells the kernel that we're fine with deferring task_work runs until we reap events. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Merge os-android.h into os-linux.h Reduce code duplication by merging the os-android.h and os-linux.h header files. The only functional change in this patch is that FIO_HAVE_SGIO is now defined in the Android build and hence that the sg I/O engine is enabled for Android. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Remove two casts from os-linux.h This patch prepares for merging the os-linux.h and os-android.h header files. While CPU_CLR() and CPU_SET() are defined as statement expressions in the Linux header files, these macros have been defined as statements in the Android header files. Remove the '(void)' casts to prevent the introduction of a build error when merging the Linux and Android header files. Signed-off-by: Bart Van Assche <bvanassche@acm.org>