disable polling for now
we'll maybe bring it back with a token bucket or something. and/or do multi-sqe submission.
This commit is contained in:
parent
3d91c5b369
commit
f254f779b5
|
@ -24,8 +24,9 @@ typedef struct io_uring_params go_io_uring_params;
|
|||
static int initialize(struct io_uring *ring, int fd) {
|
||||
struct io_uring_params params;
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.flags |= IORING_SETUP_SQPOLL;
|
||||
params.sq_thread_idle = 1000; // 1s
|
||||
// POLL
|
||||
// params.flags |= IORING_SETUP_SQPOLL;
|
||||
// params.sq_thread_idle = 1000; // 1s
|
||||
int ret;
|
||||
ret = io_uring_queue_init_params(16, ring, ¶ms); // 16: size of ring
|
||||
if (ret < 0) {
|
||||
|
@ -138,7 +139,7 @@ again:;
|
|||
}
|
||||
|
||||
// submit a write request via liburing
|
||||
static int submit_write_request(struct io_uring *ring, int fd, char *buf, int buflen, size_t idx, struct iovec *iov) {
|
||||
static int submit_write_request(struct io_uring *ring, char *buf, int buflen, size_t idx, struct iovec *iov) {
|
||||
// fprintf(stderr, "submit_write_request to fd %d buf %p %s buflen %d idx %lu\n", fd, buf, buf, buflen, idx);
|
||||
// errno= 0;
|
||||
// perror("before bonus write");
|
||||
|
|
|
@ -261,7 +261,7 @@ func (u *File) Write(buf []byte) (int, error) {
|
|||
// Do the write.
|
||||
copy(r.buf[:], buf)
|
||||
// fmt.Println("SUBMIT WRITE REQUEST")
|
||||
C.submit_write_request(u.ptr, u.fd, (*C.char)(unsafe.Pointer(&r.buf[0])), C.int(len(buf)), C.size_t(idx), &r.iov)
|
||||
C.submit_write_request(u.ptr, (*C.char)(unsafe.Pointer(&r.buf[0])), C.int(len(buf)), C.size_t(idx), &r.iov)
|
||||
// Get an extra buffer, if available.
|
||||
nidx := C.peek_file_completion(u.ptr)
|
||||
if syscall.Errno(-nidx) == syscall.EAGAIN || syscall.Errno(-nidx) == syscall.EINTR {
|
||||
|
|
Loading…
Reference in New Issue