Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvme-tcp: avoid scheduling io_work if we are already polling

When the user runs polled I/O, we shouldn't have to trigger
the workqueue to generate the receive work upon the .data_ready
upcall. This prevents a redundant context switch when the
application is already polling for completions.

Proposed-by: Mark Wunderlich <mark.wunderlich@intel.com>
Signed-off-by: Mark Wunderlich <mark.wunderlich@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Sagi Grimberg and committed by
Jens Axboe
72e5d757 386e5e6e

+5 -1
+5 -1
drivers/nvme/host/tcp.c
··· 60 60 enum nvme_tcp_queue_flags { 61 61 NVME_TCP_Q_ALLOCATED = 0, 62 62 NVME_TCP_Q_LIVE = 1, 63 + NVME_TCP_Q_POLLING = 2, 63 64 }; 64 65 65 66 enum nvme_tcp_recv_state { ··· 797 796 798 797 read_lock_bh(&sk->sk_callback_lock); 799 798 queue = sk->sk_user_data; 800 - if (likely(queue && queue->rd_enabled)) 799 + if (likely(queue && queue->rd_enabled) && 800 + !test_bit(NVME_TCP_Q_POLLING, &queue->flags)) 801 801 queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 802 802 read_unlock_bh(&sk->sk_callback_lock); 803 803 } ··· 2304 2302 if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags)) 2305 2303 return 0; 2306 2304 2305 + set_bit(NVME_TCP_Q_POLLING, &queue->flags); 2307 2306 if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue)) 2308 2307 sk_busy_loop(sk, true); 2309 2308 nvme_tcp_try_recv(queue); 2309 + clear_bit(NVME_TCP_Q_POLLING, &queue->flags); 2310 2310 return queue->nr_cqe; 2311 2311 } 2312 2312