polyphony 1.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +16 -3
  4. data/README.md +1 -0
  5. data/TODO.md +5 -13
  6. data/docs/cheat-sheet.md +248 -0
  7. data/docs/design-principles.md +59 -3
  8. data/docs/faq.md +15 -32
  9. data/docs/fiber-scheduling.md +14 -12
  10. data/docs/overview.md +140 -35
  11. data/docs/readme.md +4 -3
  12. data/docs/tutorial.md +19 -149
  13. data/examples/core/debug.rb +12 -0
  14. data/examples/core/rpc_benchmark.rb +136 -0
  15. data/ext/polyphony/polyphony.c +2 -1
  16. data/lib/polyphony/extensions/fiber.rb +1 -0
  17. data/lib/polyphony/extensions/io.rb +171 -161
  18. data/lib/polyphony/extensions/pipe.rb +3 -5
  19. data/lib/polyphony/extensions/socket.rb +45 -54
  20. data/lib/polyphony/version.rb +1 -1
  21. data/polyphony.gemspec +3 -1
  22. data/test/test_socket.rb +1 -1
  23. metadata +33 -149
  24. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +0 -1
  25. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +0 -1
  26. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +0 -1
  27. data/vendor/liburing/man/io_uring.7 +0 -781
  28. data/vendor/liburing/man/io_uring_buf_ring_add.3 +0 -53
  29. data/vendor/liburing/man/io_uring_buf_ring_advance.3 +0 -31
  30. data/vendor/liburing/man/io_uring_buf_ring_cq_advance.3 +0 -41
  31. data/vendor/liburing/man/io_uring_buf_ring_init.3 +0 -30
  32. data/vendor/liburing/man/io_uring_buf_ring_mask.3 +0 -27
  33. data/vendor/liburing/man/io_uring_check_version.3 +0 -72
  34. data/vendor/liburing/man/io_uring_close_ring_fd.3 +0 -43
  35. data/vendor/liburing/man/io_uring_cq_advance.3 +0 -49
  36. data/vendor/liburing/man/io_uring_cq_has_overflow.3 +0 -25
  37. data/vendor/liburing/man/io_uring_cq_ready.3 +0 -26
  38. data/vendor/liburing/man/io_uring_cqe_get_data.3 +0 -53
  39. data/vendor/liburing/man/io_uring_cqe_get_data64.3 +0 -1
  40. data/vendor/liburing/man/io_uring_cqe_seen.3 +0 -42
  41. data/vendor/liburing/man/io_uring_enter.2 +0 -1700
  42. data/vendor/liburing/man/io_uring_enter2.2 +0 -1
  43. data/vendor/liburing/man/io_uring_free_probe.3 +0 -27
  44. data/vendor/liburing/man/io_uring_get_events.3 +0 -33
  45. data/vendor/liburing/man/io_uring_get_probe.3 +0 -30
  46. data/vendor/liburing/man/io_uring_get_sqe.3 +0 -57
  47. data/vendor/liburing/man/io_uring_major_version.3 +0 -1
  48. data/vendor/liburing/man/io_uring_minor_version.3 +0 -1
  49. data/vendor/liburing/man/io_uring_opcode_supported.3 +0 -30
  50. data/vendor/liburing/man/io_uring_peek_cqe.3 +0 -38
  51. data/vendor/liburing/man/io_uring_prep_accept.3 +0 -197
  52. data/vendor/liburing/man/io_uring_prep_accept_direct.3 +0 -1
  53. data/vendor/liburing/man/io_uring_prep_cancel.3 +0 -118
  54. data/vendor/liburing/man/io_uring_prep_cancel64.3 +0 -1
  55. data/vendor/liburing/man/io_uring_prep_close.3 +0 -59
  56. data/vendor/liburing/man/io_uring_prep_close_direct.3 +0 -1
  57. data/vendor/liburing/man/io_uring_prep_connect.3 +0 -66
  58. data/vendor/liburing/man/io_uring_prep_fadvise.3 +0 -59
  59. data/vendor/liburing/man/io_uring_prep_fallocate.3 +0 -59
  60. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +0 -1
  61. data/vendor/liburing/man/io_uring_prep_files_update.3 +0 -92
  62. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +0 -1
  63. data/vendor/liburing/man/io_uring_prep_fsync.3 +0 -70
  64. data/vendor/liburing/man/io_uring_prep_getxattr.3 +0 -61
  65. data/vendor/liburing/man/io_uring_prep_link.3 +0 -1
  66. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +0 -94
  67. data/vendor/liburing/man/io_uring_prep_linkat.3 +0 -91
  68. data/vendor/liburing/man/io_uring_prep_madvise.3 +0 -56
  69. data/vendor/liburing/man/io_uring_prep_mkdir.3 +0 -1
  70. data/vendor/liburing/man/io_uring_prep_mkdirat.3 +0 -83
  71. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +0 -92
  72. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +0 -1
  73. data/vendor/liburing/man/io_uring_prep_multishot_accept.3 +0 -1
  74. data/vendor/liburing/man/io_uring_prep_multishot_accept_direct.3 +0 -1
  75. data/vendor/liburing/man/io_uring_prep_nop.3 +0 -28
  76. data/vendor/liburing/man/io_uring_prep_openat.3 +0 -117
  77. data/vendor/liburing/man/io_uring_prep_openat2.3 +0 -117
  78. data/vendor/liburing/man/io_uring_prep_openat2_direct.3 +0 -1
  79. data/vendor/liburing/man/io_uring_prep_openat_direct.3 +0 -1
  80. data/vendor/liburing/man/io_uring_prep_poll_add.3 +0 -72
  81. data/vendor/liburing/man/io_uring_prep_poll_multishot.3 +0 -1
  82. data/vendor/liburing/man/io_uring_prep_poll_remove.3 +0 -55
  83. data/vendor/liburing/man/io_uring_prep_poll_update.3 +0 -89
  84. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +0 -140
  85. data/vendor/liburing/man/io_uring_prep_read.3 +0 -69
  86. data/vendor/liburing/man/io_uring_prep_read_fixed.3 +0 -72
  87. data/vendor/liburing/man/io_uring_prep_readv.3 +0 -85
  88. data/vendor/liburing/man/io_uring_prep_readv2.3 +0 -111
  89. data/vendor/liburing/man/io_uring_prep_recv.3 +0 -105
  90. data/vendor/liburing/man/io_uring_prep_recv_multishot.3 +0 -1
  91. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +0 -124
  92. data/vendor/liburing/man/io_uring_prep_recvmsg_multishot.3 +0 -1
  93. data/vendor/liburing/man/io_uring_prep_remove_buffers.3 +0 -52
  94. data/vendor/liburing/man/io_uring_prep_rename.3 +0 -1
  95. data/vendor/liburing/man/io_uring_prep_renameat.3 +0 -96
  96. data/vendor/liburing/man/io_uring_prep_send.3 +0 -66
  97. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +0 -38
  98. data/vendor/liburing/man/io_uring_prep_send_zc.3 +0 -96
  99. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +0 -1
  100. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +0 -89
  101. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +0 -1
  102. data/vendor/liburing/man/io_uring_prep_setxattr.3 +0 -64
  103. data/vendor/liburing/man/io_uring_prep_shutdown.3 +0 -53
  104. data/vendor/liburing/man/io_uring_prep_socket.3 +0 -118
  105. data/vendor/liburing/man/io_uring_prep_socket_direct.3 +0 -1
  106. data/vendor/liburing/man/io_uring_prep_socket_direct_alloc.3 +0 -1
  107. data/vendor/liburing/man/io_uring_prep_splice.3 +0 -120
  108. data/vendor/liburing/man/io_uring_prep_statx.3 +0 -74
  109. data/vendor/liburing/man/io_uring_prep_symlink.3 +0 -1
  110. data/vendor/liburing/man/io_uring_prep_symlinkat.3 +0 -85
  111. data/vendor/liburing/man/io_uring_prep_sync_file_range.3 +0 -59
  112. data/vendor/liburing/man/io_uring_prep_tee.3 +0 -74
  113. data/vendor/liburing/man/io_uring_prep_timeout.3 +0 -95
  114. data/vendor/liburing/man/io_uring_prep_timeout_remove.3 +0 -1
  115. data/vendor/liburing/man/io_uring_prep_timeout_update.3 +0 -98
  116. data/vendor/liburing/man/io_uring_prep_unlink.3 +0 -1
  117. data/vendor/liburing/man/io_uring_prep_unlinkat.3 +0 -82
  118. data/vendor/liburing/man/io_uring_prep_write.3 +0 -67
  119. data/vendor/liburing/man/io_uring_prep_write_fixed.3 +0 -72
  120. data/vendor/liburing/man/io_uring_prep_writev.3 +0 -85
  121. data/vendor/liburing/man/io_uring_prep_writev2.3 +0 -111
  122. data/vendor/liburing/man/io_uring_queue_exit.3 +0 -26
  123. data/vendor/liburing/man/io_uring_queue_init.3 +0 -89
  124. data/vendor/liburing/man/io_uring_queue_init_params.3 +0 -1
  125. data/vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3 +0 -1
  126. data/vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3 +0 -1
  127. data/vendor/liburing/man/io_uring_recvmsg_name.3 +0 -1
  128. data/vendor/liburing/man/io_uring_recvmsg_out.3 +0 -82
  129. data/vendor/liburing/man/io_uring_recvmsg_payload.3 +0 -1
  130. data/vendor/liburing/man/io_uring_recvmsg_payload_length.3 +0 -1
  131. data/vendor/liburing/man/io_uring_recvmsg_validate.3 +0 -1
  132. data/vendor/liburing/man/io_uring_register.2 +0 -834
  133. data/vendor/liburing/man/io_uring_register_buf_ring.3 +0 -140
  134. data/vendor/liburing/man/io_uring_register_buffers.3 +0 -104
  135. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +0 -1
  136. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +0 -1
  137. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +0 -1
  138. data/vendor/liburing/man/io_uring_register_eventfd.3 +0 -51
  139. data/vendor/liburing/man/io_uring_register_eventfd_async.3 +0 -1
  140. data/vendor/liburing/man/io_uring_register_file_alloc_range.3 +0 -52
  141. data/vendor/liburing/man/io_uring_register_files.3 +0 -112
  142. data/vendor/liburing/man/io_uring_register_files_sparse.3 +0 -1
  143. data/vendor/liburing/man/io_uring_register_files_tags.3 +0 -1
  144. data/vendor/liburing/man/io_uring_register_files_update.3 +0 -1
  145. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +0 -1
  146. data/vendor/liburing/man/io_uring_register_iowq_aff.3 +0 -61
  147. data/vendor/liburing/man/io_uring_register_iowq_max_workers.3 +0 -71
  148. data/vendor/liburing/man/io_uring_register_ring_fd.3 +0 -49
  149. data/vendor/liburing/man/io_uring_register_sync_cancel.3 +0 -71
  150. data/vendor/liburing/man/io_uring_setup.2 +0 -669
  151. data/vendor/liburing/man/io_uring_sq_ready.3 +0 -31
  152. data/vendor/liburing/man/io_uring_sq_space_left.3 +0 -25
  153. data/vendor/liburing/man/io_uring_sqe_set_data.3 +0 -48
  154. data/vendor/liburing/man/io_uring_sqe_set_data64.3 +0 -1
  155. data/vendor/liburing/man/io_uring_sqe_set_flags.3 +0 -87
  156. data/vendor/liburing/man/io_uring_sqring_wait.3 +0 -34
  157. data/vendor/liburing/man/io_uring_submit.3 +0 -46
  158. data/vendor/liburing/man/io_uring_submit_and_get_events.3 +0 -31
  159. data/vendor/liburing/man/io_uring_submit_and_wait.3 +0 -38
  160. data/vendor/liburing/man/io_uring_submit_and_wait_timeout.3 +0 -56
  161. data/vendor/liburing/man/io_uring_unregister_buf_ring.3 +0 -30
  162. data/vendor/liburing/man/io_uring_unregister_buffers.3 +0 -27
  163. data/vendor/liburing/man/io_uring_unregister_eventfd.3 +0 -1
  164. data/vendor/liburing/man/io_uring_unregister_files.3 +0 -27
  165. data/vendor/liburing/man/io_uring_unregister_iowq_aff.3 +0 -1
  166. data/vendor/liburing/man/io_uring_unregister_ring_fd.3 +0 -32
  167. data/vendor/liburing/man/io_uring_wait_cqe.3 +0 -40
  168. data/vendor/liburing/man/io_uring_wait_cqe_nr.3 +0 -43
  169. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +0 -53
  170. data/vendor/liburing/man/io_uring_wait_cqes.3 +0 -56
@@ -1,140 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_buf_ring 3 "May 18, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_buf_ring \- register buffer ring for provided buffers
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_buf_ring(struct io_uring *" ring ",
13
- .BI " struct io_uring_buf_reg *" reg ",
14
- .BI " unsigned int " flags ");"
15
- .BI "
16
- .fi
17
- .SH DESCRIPTION
18
- .PP
19
- The
20
- .BR io_uring_register_buf_ring (3)
21
- function registers a shared buffer ring to be used with provided buffers. For
22
- the request types that support it, provided buffers are given to the ring and
23
- one is selected by a request if it has
24
- .B IOSQE_BUFFER_SELECT
25
- set in the SQE
26
- .IR flags ,
27
- when the request is ready to receive data. This allows both clear ownership
28
- of the buffer lifetime, and a way to have more read/receive type of operations
29
- in flight than buffers available.
30
-
31
- The
32
- .I reg
33
- argument must be filled in with the appropriate information. It looks as
34
- follows:
35
- .PP
36
- .in +4n
37
- .EX
38
- struct io_uring_buf_reg {
39
- __u64 ring_addr;
40
- __u32 ring_entries;
41
- __u16 bgid;
42
- __u16 pad;
43
- __u64 resv[3];
44
- };
45
- .EE
46
- .in
47
- .PP
48
- The
49
- .I ring_addr
50
- field must contain the address to the memory allocated to fit this ring.
51
- The memory must be page aligned and hence allocated appropriately using eg
52
- .BR posix_memalign (3)
53
- or similar. The size of the ring is the product of
54
- .I ring_entries
55
- and the size of
56
- .IR "struct io_uring_buf" .
57
- .I ring_entries
58
- is the desired size of the ring, and must be a power-of-2 in size. The maximum
59
- size allowed is 2^15 (32768).
60
- .I bgid
61
- is the buffer group ID associated with this ring. SQEs that select a buffer
62
- have a buffer group associated with them in their
63
- .I buf_group
64
- field, and the associated CQEs will have
65
- .B IORING_CQE_F_BUFFER
66
- set in their
67
- .I flags
68
- member, which will also contain the specific ID of the buffer selected. The rest
69
- of the fields are reserved and must be cleared to zero.
70
-
71
- The
72
- .I flags
73
- argument is currently unused and must be set to zero.
74
-
75
- A shared buffer ring looks as follows:
76
- .PP
77
- .in +4n
78
- .EX
79
- struct io_uring_buf_ring {
80
- union {
81
- struct {
82
- __u64 resv1;
83
- __u32 resv2;
84
- __u16 resv3;
85
- __u16 tail;
86
- };
87
- struct io_uring_buf bufs[0];
88
- };
89
- };
90
- .EE
91
- .in
92
- .PP
93
- where
94
- .I tail
95
- is the index at which the application can insert new buffers for consumption
96
- by requests, and
97
- .I struct io_uring_buf
98
- is buffer definition:
99
- .PP
100
- .in +4n
101
- .EX
102
- struct io_uring_buf {
103
- __u64 addr;
104
- __u32 len;
105
- __u16 bid;
106
- __u16 resv;
107
- };
108
- .EE
109
- .in
110
- .PP
111
- where
112
- .I addr
113
- is the address for the buffer,
114
- .I len
115
- is the length of the buffer in bytes, and
116
- .I bid
117
- is the buffer ID that will be returned in the CQE once consumed.
118
-
119
- Reserved fields must not be touched. Applications must use
120
- .BR io_uring_buf_ring_init (3)
121
- to initialise the buffer ring before use. Applications may use
122
- .BR io_uring_buf_ring_add (3)
123
- and
124
- .BR io_uring_buf_ring_advance (3)
125
- or
126
- .BR io_uring_buf_ring_cq_advance (3)
127
- to provide buffers, which will set these fields and update the tail.
128
-
129
- Available since 5.19.
130
-
131
- .SH RETURN VALUE
132
- On success
133
- .BR io_uring_register_buf_ring (3)
134
- returns 0. On failure it returns
135
- .BR -errno .
136
- .SH SEE ALSO
137
- .BR io_uring_buf_ring_init (3),
138
- .BR io_uring_buf_ring_add (3),
139
- .BR io_uring_buf_ring_advance (3),
140
- .BR io_uring_buf_ring_cq_advance (3)
@@ -1,104 +0,0 @@
1
- .\" Copyright (C) 2021 Stefan Roesch <shr@fb.com>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_buffers 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_buffers \- register buffers for fixed buffer operations
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_buffers(struct io_uring *" ring ","
13
- .BI " const struct iovec *" iovecs ","
14
- .BI " unsigned " nr_iovecs ");"
15
- .PP
16
- .BI "int io_uring_register_buffers_tags(struct io_uring *" ring ","
17
- .BI " const struct iovec *" iovecs ","
18
- .BI " const __u64 *" tags ","
19
- .BI " unsigned " nr ");"
20
- .PP
21
- .BI "int io_uring_register_buffers_sparse(struct io_uring *" ring ","
22
- .BI " unsigned " nr_iovecs ");"
23
- .PP
24
- .BI "int io_uring_register_buffers_update_tag(struct io_uring *" ring ","
25
- .BI " unsigned " off ","
26
- .BI " const struct iovec *" iovecs ","
27
- .BI " const __u64 *" tags ","
28
- .BI " unsigned " nr ");"
29
- .fi
30
- .SH DESCRIPTION
31
- .PP
32
- The
33
- .BR io_uring_register_buffers (3)
34
- function registers
35
- .I nr_iovecs
36
- number of buffers defined by the array
37
- .I iovecs
38
- belonging to the
39
- .IR ring .
40
-
41
- The
42
- .BR io_uring_register_buffers_tags (3)
43
- function behaves the same as
44
- .BR io_uring_register_buffers (3)
45
- function but additionally takes
46
- .I tags
47
- parameter. See
48
- .B IORING_REGISTER_BUFFERS2
49
- for the resource tagging description.
50
-
51
- The
52
- .BR io_uring_register_buffers_sparse (3)
53
- function registers
54
- .I nr_iovecs
55
- empty buffers belonging to the
56
- .IR ring .
57
- These buffers must be updated before use, using eg
58
- .BR io_uring_register_buffers_update_tag (3).
59
-
60
- After the caller has registered the buffers, they can be used with one of the
61
- fixed buffers functions.
62
-
63
- Registered buffers is an optimization that is useful in conjunction with
64
- .B O_DIRECT
65
- reads and writes, where it maps the specified range into the kernel once when
66
- the buffer is registered rather than doing a map and unmap for each IO
67
- every time IO is performed to that region. Additionally, it also avoids
68
- manipulating the page reference counts for each IO.
69
-
70
- The
71
- .BR io_uring_register_buffers_update_tag (3)
72
- function updates registered buffers with new ones, either turning a sparse
73
- entry into a real one, or replacing an existing entry. The
74
- .I off
75
- is offset on which to start the update
76
- .I nr
77
- number of buffers defined by the array
78
- .I iovecs
79
- belonging to the
80
- .IR ring .
81
- The
82
- .I tags
83
- points to an array of tags. See
84
- .B IORING_REGISTER_BUFFERS2
85
- for the resource tagging description.
86
-
87
- .SH RETURN VALUE
88
- On success
89
- .BR io_uring_register_buffers (3),
90
- .BR io_uring_register_buffers_tags (3)
91
- and
92
- .BR io_uring_register_buffers_sparse (3)
93
- return 0.
94
- .BR io_uring_register_buffers_update_tag (3)
95
- return number of buffers updated.
96
- On failure they return
97
- .BR -errno .
98
- .SH SEE ALSO
99
- .BR io_uring_register (2),
100
- .BR io_uring_get_sqe (3),
101
- .BR io_uring_unregister_buffers (3),
102
- .BR io_uring_register_buf_ring (3),
103
- .BR io_uring_prep_read_fixed (3),
104
- .BR io_uring_prep_write_fixed (3)
@@ -1 +0,0 @@
1
- io_uring_register_buffers.3
@@ -1 +0,0 @@
1
- io_uring_register_buffers.3
@@ -1 +0,0 @@
1
- io_uring_register_buffers.3
@@ -1,51 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_eventfd 3 "April 16, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_eventfd \- register an eventfd with a ring
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_eventfd(struct io_uring *" ring ","
13
- .BI " int " fd ");"
14
- .PP
15
- .BI "int io_uring_register_eventfd_async(struct io_uring *" ring ","
16
- .BI " int " fd ");"
17
- .PP
18
- .BI "int io_uring_unregister_eventfd(struct io_uring *" ring ");"
19
- .fi
20
- .SH DESCRIPTION
21
- .PP
22
- .BR io_uring_register_eventfd (3)
23
- registers the eventfd file descriptor
24
- .I fd
25
- with the ring identified by
26
- .IR ring .
27
-
28
- Whenever completions are posted to the CQ ring, an eventfd notification
29
- is generated with the registered eventfd descriptor. If
30
- .BR io_uring_register_eventfd_async (3)
31
- is used, only events that completed out-of-line will trigger a notification.
32
-
33
- It notifications are no longer desired,
34
- .BR io_uring_unregister_eventfd (3)
35
- may be called to remove the eventfd registration. No eventfd argument is
36
- needed, as a ring can only have a single eventfd registered.
37
-
38
- .SH NOTES
39
- While io_uring generally takes care to avoid spurious events, they can occur.
40
- Similarly, batched completions of CQEs may only trigger a single eventfd
41
- notification even if multiple CQEs are posted. The application should make no
42
- assumptions on number of events being available having a direct correlation to
43
- eventfd notifications posted. An eventfd notification must thus only be treated
44
- as a hint to check the CQ ring for completions.
45
- .SH RETURN VALUE
46
- Returns 0 on success, or
47
- or
48
- .BR -errno
49
- on error.
50
- .SH SEE ALSO
51
- .BR eventfd (2)
@@ -1 +0,0 @@
1
- io_uring_register_eventfd.3
@@ -1,52 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_file_alloc_range 3 "Oct 21, 2022" "liburing-2.3" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_file_alloc_range \- set range for fixed file allocations
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_file_alloc_range(struct io_uring *" ring ",
13
- .BI " unsigned " off ","
14
- .BI " unsigned " len ");"
15
- .BI "
16
- .fi
17
- .SH DESCRIPTION
18
- .PP
19
- The
20
- .BR io_uring_register_file_alloc_range (3)
21
- function sets the allowable range for fixed file index allocations within the
22
- kernel. When requests that can instantiate a new fixed file are used with
23
- .B IORING_FILE_INDEX_ALLOC ,
24
- the application is asking the kernel to allocate a new fixed file descriptor
25
- rather than pass in a specific value for one. By default, the kernel will
26
- pick any available fixed file descriptor within the range available. Calling
27
- this function with
28
- .I off
29
- set to the starting offset and
30
- .I len
31
- set to the number of descriptors, the application can limit the allocated
32
- descriptors to that particular range. This effectively allows the application
33
- to set aside a range just for dynamic allocations, with the remainder being
34
- used for specific values.
35
-
36
- The application must have registered a fixed file table upfront, eg through
37
- .BR io_uring_register_files (3)
38
- or
39
- .BR io_uring_register_files_sparse (3) .
40
-
41
- Available since 6.0.
42
-
43
- .SH RETURN VALUE
44
- On success
45
- .BR io_uring_register_buf_ring (3)
46
- returns 0. On failure it returns
47
- .BR -errno .
48
- .SH SEE ALSO
49
- .BR io_uring_register_files (3)
50
- .BR io_uring_prep_accept_direct (3)
51
- .BR io_uring_prep_openat_direct (3)
52
- .BR io_uring_prep_socket_direct (3)
@@ -1,112 +0,0 @@
1
- .\" Copyright (C) 2021 Stefan Roesch <shr@fb.com>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_files 3 "November 15, 2021" "liburing-2.1" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_files \- register file descriptors
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_files(struct io_uring *" ring ","
13
- .BI " const int *" files ","
14
- .BI " unsigned " nr_files ");"
15
- .PP
16
- .BI "int io_uring_register_files_tags(struct io_uring *" ring ","
17
- .BI " const int *" files ","
18
- .BI " const __u64 *" tags ","
19
- .BI " unsigned " nr ");"
20
- .PP
21
- .BI "int io_uring_register_files_sparse(struct io_uring *" ring ","
22
- .BI " unsigned " nr_files ");"
23
- .PP
24
- .BI "int io_uring_register_files_update(struct io_uring *" ring ","
25
- .BI " unsigned " off ","
26
- .BI " const int *" files ","
27
- .BI " unsigned " nr_files ");"
28
- .PP
29
- .BI "int io_uring_register_files_update_tag(struct io_uring *" ring ","
30
- .BI " unsigned " off ","
31
- .BI " const int *" files ","
32
- .BI " const __u64 *" tags ","
33
- .BI " unsigned " nr_files ");"
34
- .fi
35
- .SH DESCRIPTION
36
- .PP
37
- The
38
- .BR io_uring_register_files (3)
39
- function registers
40
- .I nr_files
41
- number of file descriptors defined by the array
42
- .I files
43
- belonging to the
44
- .I ring
45
- for subsequent operations.
46
-
47
- The
48
- .BR io_uring_register_files_tags (3)
49
- function behaves the same as
50
- .BR io_uring_register_files (3)
51
- function but additionally takes
52
- .I tags
53
- parameter. See
54
- .B IORING_REGISTER_BUFFERS2
55
- for the resource tagging description.
56
-
57
- The
58
- .BR io_uring_register_files_sparse (3)
59
- function registers an empty file table of
60
- .I nr_files
61
- number of file descriptors. These files must be updated before use, using eg
62
- .BR io_uring_register_files_update_tag (3).
63
- The sparse variant is available in kernels 5.19 and later.
64
-
65
- Registering a file table is a prerequisite for using any request that uses
66
- direct descriptors.
67
-
68
- Registered files have less overhead per operation than normal files. This
69
- is due to the kernel grabbing a reference count on a file when an operation
70
- begins, and dropping it when it's done. When the process file table is
71
- shared, for example if the process has ever created any threads, then this
72
- cost goes up even more. Using registered files reduces the overhead of
73
- file reference management across requests that operate on a file.
74
-
75
- The
76
- .BR io_uring_register_files_update (3)
77
- function updates existing registered files. The
78
- .I off
79
- is offset on which to start the update
80
- .I nr_files
81
- number of files defined by the array
82
- .I files
83
- belonging to the
84
- .IR ring .
85
-
86
- The
87
- .BR io_uring_register_files_update_tag (3)
88
- function behaves the same as
89
- .BR io_uring_register_files_update (3)
90
- function but additionally takes
91
- .I tags
92
- parameter. See
93
- .B IORING_REGISTER_BUFFERS2
94
- for the resource tagging description.
95
-
96
- .SH RETURN VALUE
97
- On success
98
- .BR io_uring_register_files (3),
99
- .BR io_uring_register_files_tags (3)
100
- and
101
- .BR io_uring_register_files_sparse (3)
102
- return 0.
103
- .BR io_uring_register_files_update (3)
104
- and
105
- .BR io_uring_register_files_update_tag (3)
106
- return number of files updated.
107
- On failure they return
108
- .BR -errno .
109
- .SH SEE ALSO
110
- .BR io_uring_register (2),
111
- .BR io_uring_get_sqe (3),
112
- .BR io_uring_unregister_files (3)
@@ -1 +0,0 @@
1
- io_uring_register_files.3
@@ -1 +0,0 @@
1
- io_uring_register_files.3
@@ -1 +0,0 @@
1
- io_uring_register_files.3
@@ -1 +0,0 @@
1
- io_uring_register_files.3
@@ -1,61 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_iowq_aff 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_iowq_aff \- register async worker CPU affinities
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <sched.h>
11
- .B #include <liburing.h>
12
- .PP
13
- .BI "int io_uring_register_iowq_aff(struct io_uring *" ring ","
14
- .BI " size_t " cpusz ","
15
- .BI " const cpu_set_t *" mask ");
16
- .PP
17
- .BI "void io_uring_unregister_iowq_aff(struct io_uring *" ring ");"
18
- .fi
19
- .SH DESCRIPTION
20
- .PP
21
- The
22
- .BR io_uring_prep_register_iowq_aff (3)
23
- function registers a set of CPU affinities to be used by the io_uring async
24
- workers. By default, io_uring async workers are allowed to run on any CPU in
25
- the system. If this function is called with
26
- .I ring
27
- set to the ring in question and
28
- .I mask
29
- set to a pointer to a
30
- .B cpu_set_t
31
- value and
32
- .I cpusz
33
- set to the size of the CPU set, then async workers will only be allowed to run
34
- on the CPUs specified in the mask. Existing workers may need to hit a schedule
35
- point before they are migrated.
36
-
37
- For unregistration,
38
- .BR io_uring_unregister_iowq_aff (3)
39
- may be called to restore CPU affinities to the default.
40
-
41
- .SH RETURN VALUE
42
- Returns
43
- .B 0
44
- on success, or any of the following values in case of error.
45
- .TP
46
- .B -EFAULT
47
- The kernel was unable to copy the memory pointer to by
48
- .I mask
49
- as it was invalid.
50
- .TP
51
- .B -ENOMEM
52
- The kernel was unable to allocate memory for the new CPU mask.
53
- .TP
54
- .B -EINVAL
55
- .I cpusz
56
- or
57
- .I mask
58
- was NULL/0, or any other value specified was invalid.
59
- .SH SEE ALSO
60
- .BR io_uring_queue_init (3),
61
- .BR io_uring_register (2)
@@ -1,71 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_iowq_max_workers 3 "March 13, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_iowq_max_workers \- modify the maximum allowed async workers
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_iowq_max_workers(struct io_uring *" ring ","
13
- .BI " unsigned int *" values ");"
14
- .fi
15
- .SH DESCRIPTION
16
- .PP
17
- io_uring async workers are split into two types:
18
- .TP
19
- .B Bounded
20
- These workers have a bounded execution time. Examples of that are filesystem
21
- reads, which normally complete in a relatively short amount of time. In case
22
- of disk failures, they are still bounded by a timeout operation that will
23
- abort them if exceeded.
24
- .TP
25
- .B Unbounded
26
- Work items here may take an indefinite amount of time to complete. Examples
27
- include doing IO to sockets, pipes, or any other non-regular type of file.
28
-
29
- .PP
30
- By default, the amount of bounded IO workers is limited to how many SQ entries
31
- the ring was setup with, or 4 times the number of online CPUs in the system,
32
- whichever is smaller. Unbounded workers are only limited by the process task
33
- limit, as indicated by the rlimit
34
- .B RLIMIT_NPROC
35
- limit.
36
-
37
- This can be modified by calling
38
- .B io_uring_register_iowq_max_workers
39
- with
40
- .I ring
41
- set to the ring in question, and
42
- .I values
43
- pointing to an array of two values. The first element should contain the number
44
- of desired bounded workers, and the second element should contain the number
45
- of desired unbounded workers. These are both maximum values, io_uring will
46
- not maintain a high count of idle workers, they are reaped when they are not
47
- necessary anymore.
48
-
49
- If called with both values set to 0, the existing values are returned.
50
-
51
- .SH RETURN VALUE
52
- Returns
53
- .B 0
54
- on success, with
55
- .I values
56
- containing the previous values for the settings. On error, any of the following
57
- may be returned.
58
- .TP
59
- .B -EFAULT
60
- The kernel was unable to copy the memory pointer to by
61
- .I values
62
- as it was invalid.
63
- .TP
64
- .B -EINVAL
65
- .I values
66
- was
67
- .B NULL
68
- or the new values exceeded the maximum allowed value.
69
- .SH SEE ALSO
70
- .BR io_uring_queue_init (3),
71
- .BR io_uring_register (2)
@@ -1,49 +0,0 @@
1
- .\" Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
2
- .\"
3
- .\" SPDX-License-Identifier: LGPL-2.0-or-later
4
- .\"
5
- .TH io_uring_register_ring_fd 3 "March 11, 2022" "liburing-2.2" "liburing Manual"
6
- .SH NAME
7
- io_uring_register_ring_fd \- register a ring file descriptor
8
- .SH SYNOPSIS
9
- .nf
10
- .B #include <liburing.h>
11
- .PP
12
- .BI "int io_uring_register_ring_fd(struct io_uring *" ring ");"
13
- .fi
14
- .SH DESCRIPTION
15
- .PP
16
- .BR io_uring_register_ring_fd (3)
17
- registers the file descriptor of the ring.
18
-
19
- Whenever
20
- .BR io_uring_enter (2)
21
- is called to submit request or wait for completions, the kernel must grab a
22
- reference to the file descriptor. If the application using io_uring is threaded,
23
- the file table is marked as shared, and the reference grab and put of the file
24
- descriptor count is more expensive than it is for a non-threaded application.
25
-
26
- Similarly to how io_uring allows registration of files, this allow registration
27
- of the ring file descriptor itself. This reduces the overhead of the
28
- .BR io_uring_enter (2)
29
- system call.
30
-
31
- If an application using liburing is threaded, then an application should call
32
- this function to register the ring descriptor when a ring is set up. See NOTES
33
- for restrictions when a ring is shared.
34
-
35
- .SH NOTES
36
- When the ring descriptor is registered, it is stored internally in the
37
- .I struct io_uring
38
- structure. For applications that share a ring between threads, for example
39
- having one thread do submits and another reap events, then this optimization
40
- cannot be used as each thread may have a different index for the registered
41
- ring fd.
42
- .SH RETURN VALUE
43
- Returns 1 on success, indicating that one file descriptor was registered,
44
- or
45
- .BR -errno
46
- on error.
47
- .SH SEE ALSO
48
- .BR io_uring_unregister_ring_fd (3),
49
- .BR io_uring_register_files (3)