Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397143

RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets

From Dexuan Cui <decui@microsoft.com>
Newsgroups linux.kernel
Subject RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
Date 2016-05-09 17:30 +0200
Message-ID <rwVia-8if-7@gated-at.bofh.it> (permalink)
References <rw7Y5-8qa-9@gated-at.bofh.it> <rwewz-5Wi-23@gated-at.bofh.it> <rwqel-1sM-3@gated-at.bofh.it> <rwB06-2PY-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, May 9, 2016 1:45
> To: Dexuan Cui <decui@microsoft.com>
> Cc: gregkh@linuxfoundation.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com; cavery@redhat.com; KY
> Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>;
> joe@perches.com; vkuznets@redhat.com
> Subject: Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
>
> From: Dexuan Cui <decui@microsoft.com>
> Date: Sun, 8 May 2016 06:11:04 +0000
>
> > Thanks for pointing this out!
> > I understand, so I think I should add a module parameter, e.g.,
> > "hv_sock.max_socket_number" with a default value, say, 1024?
>
> No, you should get rid of the huge multi-page buffers.

Hi David,
Ok, how do you like the below proof-of-concept patch snippet?

I use 1 page for the recv buf and another page for send buf. They should be
allocated by kmalloc(sizeof(struct hvsock_send/recv_buf), GFP_KERNEL).

And, by default, I use 2 pages for VMBUS send/recv ringbuffers respectively.
(Note: 2 is the minimal ringbuffer size because actually 1 page of the two is used
as the shared read/write index etc, rather than data)
A module parameter will be added to allow the user to use a big ringbuffer
size, if the user cares too much about the performance.

Another parameter will be added to limit how many hvsock sockets can be
created at most. The default value can be 1024, meaning at most
1024 * (2+2+1+1) * 4KB = 24MB memory is used.

-#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (5 * PAGE_SIZE)
-#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (5 * PAGE_SIZE)
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (2 * PAGE_SIZE)
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (2 * PAGE_SIZE)

-#define HVSOCK_RCV_BUF_SZ      VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV
+#define HVSOCK_RCV_BUF_SZ      PAGE_SIZE
 #define HVSOCK_SND_BUF_SZ      PAGE_SIZE

+struct hvsock_send_buf {
+       struct vmpipe_proto_header hdr;
+       u8 buf[HVSOCK_SND_BUF_SZ];
+};
+
+struct hvsock_recv_buf {
+       struct vmpipe_proto_header hdr;
+       u8 buf[HVSOCK_RCV_BUF_SZ];
+
+       unsigned int data_len;
+       unsigned int data_offset;
+};
+
@@ -35,21 +48,8 @@ struct hvsock_sock {

        struct vmbus_channel *channel;

-       struct {
-               struct vmpipe_proto_header hdr;
-               u8 buf[HVSOCK_SND_BUF_SZ];
-       } send;
-
-       struct {
-               struct vmpipe_proto_header hdr;
-               u8 buf[HVSOCK_RCV_BUF_SZ];
-
-               unsigned int data_len;
-               unsigned int data_offset;
-       } recv;
+       struct hvsock_send_buf *send_buf;
+       struct hvsock_recv_buf *recv_buf;
 };

Thanks,
-- Dexuan

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets David Miller <davem@davemloft.net> - 2016-05-06 19:10 +0200
  RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets Dexuan Cui <decui@microsoft.com> - 2016-05-07 12:50 +0200
    Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets David Miller <davem@davemloft.net> - 2016-05-07 19:50 +0200
      RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets Dexuan Cui <decui@microsoft.com> - 2016-05-08 08:20 +0200
        Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets David Miller <davem@davemloft.net> - 2016-05-08 19:50 +0200
          RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets Dexuan Cui <decui@microsoft.com> - 2016-05-09 17:30 +0200

csiph-web