netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] virtio support cache indirect desc
@ 2021-10-27  6:19 Xuan Zhuo
  2021-10-27  6:19 ` [PATCH 1/3] virtio: cache indirect desc for split Xuan Zhuo
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Xuan Zhuo @ 2021-10-27  6:19 UTC (permalink / raw)
  To: virtualization, netdev
  Cc: Michael S. Tsirkin, Jason Wang, David S. Miller, Jakub Kicinski

If the VIRTIO_RING_F_INDIRECT_DESC negotiation succeeds, and the number
of sgs used for sending packets is greater than 1. We must constantly
call __kmalloc/kfree to allocate/release desc.

In the case of extremely fast package delivery, the overhead cannot be
ignored:

  27.46%  [kernel]  [k] virtqueue_add
  16.66%  [kernel]  [k] detach_buf_split
  16.51%  [kernel]  [k] virtnet_xsk_xmit
  14.04%  [kernel]  [k] virtqueue_add_outbuf
   5.18%  [kernel]  [k] __kmalloc
   4.08%  [kernel]  [k] kfree
   2.80%  [kernel]  [k] virtqueue_get_buf_ctx
   2.22%  [kernel]  [k] xsk_tx_peek_desc
   2.08%  [kernel]  [k] memset_erms
   0.83%  [kernel]  [k] virtqueue_kick_prepare
   0.76%  [kernel]  [k] virtnet_xsk_run
   0.62%  [kernel]  [k] __free_old_xmit_ptr
   0.60%  [kernel]  [k] vring_map_one_sg
   0.53%  [kernel]  [k] native_apic_mem_write
   0.46%  [kernel]  [k] sg_next
   0.43%  [kernel]  [k] sg_init_table
   0.41%  [kernel]  [k] kmalloc_slab

This patch adds a cache function to virtio to cache these allocated indirect
desc instead of constantly allocating and releasing desc.


Xuan Zhuo (3):
  virtio: cache indirect desc for split
  virtio: cache indirect desc for packed
  virtio-net: enable virtio indirect cache

 drivers/net/virtio_net.c     |   4 ++
 drivers/virtio/virtio.c      |   6 ++
 drivers/virtio/virtio_ring.c | 120 ++++++++++++++++++++++++++++++-----
 include/linux/virtio.h       |  10 +++
 4 files changed, 123 insertions(+), 17 deletions(-)

--
2.31.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-10-31 14:47 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-27  6:19 [PATCH 0/3] virtio support cache indirect desc Xuan Zhuo
2021-10-27  6:19 ` [PATCH 1/3] virtio: cache indirect desc for split Xuan Zhuo
2021-10-27  8:55   ` Michael S. Tsirkin
2021-10-27 16:33   ` Dongli Zhang
2021-10-27 19:36     ` Michael S. Tsirkin
2021-10-27 17:07   ` Michael S. Tsirkin
2021-10-28  2:16     ` Jason Wang
     [not found]       ` <1635401763.7680635-3-xuanzhuo@linux.alibaba.com>
2021-10-31 14:47         ` Michael S. Tsirkin
2021-10-27 23:02   ` kernel test robot
2021-10-28  0:57   ` kernel test robot
2021-10-27  6:19 ` [PATCH 2/3] virtio: cache indirect desc for packed Xuan Zhuo
2021-10-28  0:28   ` kernel test robot
2021-10-28  3:51   ` kernel test robot
2021-10-28  7:38   ` kernel test robot
2021-10-27  6:19 ` [PATCH 3/3] virtio-net: enable virtio indirect cache Xuan Zhuo
2021-10-27 15:55   ` Jakub Kicinski
     [not found]     ` <1635386220.8124611-1-xuanzhuo@linux.alibaba.com>
2021-10-28  2:28       ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).