File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,30 @@ impl<'a> Submitter<'a> {
396
396
. map ( drop)
397
397
}
398
398
399
+ /// Tell io_uring on what CPUs the async workers can run. By default, async workers
400
+ /// created by io_uring will inherit the CPU mask of its parent. This is usually
401
+ /// all the CPUs in the system, unless the parent is being run with a limited set.
402
+ pub fn register_iowq_aff ( & self , cpu_set : & libc:: cpu_set_t ) -> io:: Result < ( ) > {
403
+ execute (
404
+ self . fd . as_raw_fd ( ) ,
405
+ sys:: IORING_REGISTER_IOWQ_AFF ,
406
+ cpu_set as * const _ as * const libc:: c_void ,
407
+ mem:: size_of :: < libc:: cpu_set_t > ( ) as u32 ,
408
+ )
409
+ . map ( drop)
410
+ }
411
+
412
+ /// Undoes a CPU mask previously set with register_iowq_aff
413
+ pub fn unregister_iowq_aff ( & self ) -> io:: Result < ( ) > {
414
+ execute (
415
+ self . fd . as_raw_fd ( ) ,
416
+ sys:: IORING_UNREGISTER_IOWQ_AFF ,
417
+ ptr:: null ( ) ,
418
+ 0 ,
419
+ )
420
+ . map ( drop)
421
+ }
422
+
399
423
/// Get and/or set the limit for number of io_uring worker threads per NUMA
400
424
/// node. `max[0]` holds the limit for bounded workers, which process I/O
401
425
/// operations expected to be bound in time, that is I/O on regular files or
You can’t perform that action at this time.
0 commit comments