* Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
@ 2024-10-25 16:18 Guan Xin
2024-10-25 21:52 ` Dominique Martinet
0 siblings, 1 reply; 6+ messages in thread
From: Guan Xin @ 2024-10-25 16:18 UTC (permalink / raw)
To: v9fs; +Cc: Linux Kernel Network Developers, linux-fsdevel,
Eric Van Hensbergen
For HPC applications the hard-coded VIRTQUEUE_NUM of 128 seems to
limit the throughput of guest systems accessing cluster filesystems
mounted on the host.
Just increase VIRTQUEUE_NUM for kernels with a
larger stack.
Author: GUAN Xin <guanx.bac@gmail.com>
Signed-off-by: GUAN Xin <guanx.bac@gmail.com>
cc: Eric Van Hensbergen <ericvh@kernel.org>
cc: v9fs@lists.linux.dev
cc: netdev@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
--- net/9p/trans_virtio.c.orig 2024-10-25 10:25:09.390922517 +0800
+++ net/9p/trans_virtio.c 2024-10-25 16:48:40.451680192 +0800
@@ -31,11 +31,12 @@
#include <net/9p/transport.h>
#include <linux/scatterlist.h>
#include <linux/swap.h>
+#include <linux/thread_info.h>
#include <linux/virtio.h>
#include <linux/virtio_9p.h>
#include "trans_common.h"
-#define VIRTQUEUE_NUM 128
+#define VIRTQUEUE_NUM (1 << (THREAD_SIZE_ORDER + PAGE_SHIFT - 6))
/* a single mutex to manage channel initialization and attachment */
static DEFINE_MUTEX(virtio_9p_lock);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
2024-10-25 16:18 Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size Guan Xin
@ 2024-10-25 21:52 ` Dominique Martinet
2024-10-26 7:07 ` [PATCH] " Guan Xin
2024-10-26 9:36 ` Christian Schoenebeck
0 siblings, 2 replies; 6+ messages in thread
From: Dominique Martinet @ 2024-10-25 21:52 UTC (permalink / raw)
To: Christian Schoenebeck, Guan Xin
Cc: v9fs, Linux Kernel Network Developers, linux-fsdevel,
Eric Van Hensbergen
Christian,
this is more up your alley, letting you comment as well as you weren't
even sent a copy in Ccs
Guan,
overall, please check Documentation/process/submitting-patches.rst -
this is missing [PATCH] in the mail header, missing some recipients that
you'd have gotten from get_maintiner.pl, and the commit title is a mess.
Have a look at other recent patches on https://lore.kernel.org/v9fs/
Guan Xin wrote on Sat, Oct 26, 2024 at 12:18:42AM +0800:
> For HPC applications the hard-coded VIRTQUEUE_NUM of 128 seems to
> limit the throughput of guest systems accessing cluster filesystems
> mounted on the host.
>
> Just increase VIRTQUEUE_NUM for kernels with a
> larger stack.
You're replacing an hardcoded value with another, this could be made
dynamic e.g. as a module_param so someone could tune this based on their
actual needs (and test more easily); I'd more readily accept such a
patch.
> Author: GUAN Xin <guanx.bac@gmail.com>
Author: tag doesn't exist and would be useless here as it's the mail you
sent the patch from.
> Signed-off-by: GUAN Xin <guanx.bac@gmail.com>
> cc: Eric Van Hensbergen <ericvh@kernel.org>
> cc: v9fs@lists.linux.dev
> cc: netdev@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
>
> --- net/9p/trans_virtio.c.orig 2024-10-25 10:25:09.390922517 +0800
> +++ net/9p/trans_virtio.c 2024-10-25 16:48:40.451680192 +0800
> @@ -31,11 +31,12 @@
> #include <net/9p/transport.h>
> #include <linux/scatterlist.h>
> #include <linux/swap.h>
> +#include <linux/thread_info.h>
> #include <linux/virtio.h>
> #include <linux/virtio_9p.h>
> #include "trans_common.h"
>
> -#define VIRTQUEUE_NUM 128
> +#define VIRTQUEUE_NUM (1 << (THREAD_SIZE_ORDER + PAGE_SHIFT - 6))
(FWIW that turned out to be 256 on my system)
> /* a single mutex to manage channel initialization and attachment */
> static DEFINE_MUTEX(virtio_9p_lock);
>
--
Dominique Martinet | Asmadeus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
2024-10-25 21:52 ` Dominique Martinet
@ 2024-10-26 7:07 ` Guan Xin
2024-10-26 9:36 ` Christian Schoenebeck
1 sibling, 0 replies; 6+ messages in thread
From: Guan Xin @ 2024-10-26 7:07 UTC (permalink / raw)
To: Dominique Martinet
Cc: Christian Schoenebeck, v9fs, Linux Kernel Network Developers,
linux-fsdevel, Eric Van Hensbergen
Dominique,
On Sat, Oct 26, 2024 at 5:53 AM Dominique Martinet
<asmadeus@codewreck.org> wrote:
>
>> Have a look at other recent patches on https://lore.kernel.org/v9fs/
Sorry I'm new to Linux and didn't find out the exact workflow from the
numerous instruction files.
Thank you for pointing me to the examples!
This is greatly helpful.
Guan
P.S. Patch attached:
> Guan Xin wrote on Sat, Oct 26, 2024 at 12:18:42AM +0800:
> > For HPC applications the hard-coded VIRTQUEUE_NUM of 128 seems to
> > limit the throughput of guest systems accessing cluster filesystems
> > mounted on the host.
> >
> > Just increase VIRTQUEUE_NUM for kernels with a
> > larger stack.
>
> You're replacing an hardcoded value with another, this could be made
> dynamic e.g. as a module_param so someone could tune this based on their
> actual needs (and test more easily); I'd more readily accept such a
> patch.
>
> > Author: GUAN Xin <guanx.bac@gmail.com>
>
> Author: tag doesn't exist and would be useless here as it's the mail you
> sent the patch from.
>
> > Signed-off-by: GUAN Xin <guanx.bac@gmail.com>
> > cc: Eric Van Hensbergen <ericvh@kernel.org>
> > cc: v9fs@lists.linux.dev
> > cc: netdev@vger.kernel.org
> > cc: linux-fsdevel@vger.kernel.org
> >
> > --- net/9p/trans_virtio.c.orig 2024-10-25 10:25:09.390922517 +0800
> > +++ net/9p/trans_virtio.c 2024-10-25 16:48:40.451680192 +0800
> > @@ -31,11 +31,12 @@
> > #include <net/9p/transport.h>
> > #include <linux/scatterlist.h>
> > #include <linux/swap.h>
> > +#include <linux/thread_info.h>
> > #include <linux/virtio.h>
> > #include <linux/virtio_9p.h>
> > #include "trans_common.h"
> >
> > -#define VIRTQUEUE_NUM 128
> > +#define VIRTQUEUE_NUM (1 << (THREAD_SIZE_ORDER + PAGE_SHIFT - 6))
>
> (FWIW that turned out to be 256 on my system)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
2024-10-25 21:52 ` Dominique Martinet
2024-10-26 7:07 ` [PATCH] " Guan Xin
@ 2024-10-26 9:36 ` Christian Schoenebeck
2024-10-26 10:14 ` Guan Xin
2024-10-27 13:11 ` Christian Schoenebeck
1 sibling, 2 replies; 6+ messages in thread
From: Christian Schoenebeck @ 2024-10-26 9:36 UTC (permalink / raw)
To: Guan Xin, Dominique Martinet
Cc: v9fs, Linux Kernel Network Developers, linux-fsdevel,
Eric Van Hensbergen
On Friday, October 25, 2024 11:52:56 PM CEST Dominique Martinet wrote:
> Christian,
>
> this is more up your alley, letting you comment as well as you weren't
> even sent a copy in Ccs
[...]
> > Signed-off-by: GUAN Xin <guanx.bac@gmail.com>
> > cc: Eric Van Hensbergen <ericvh@kernel.org>
> > cc: v9fs@lists.linux.dev
> > cc: netdev@vger.kernel.org
> > cc: linux-fsdevel@vger.kernel.org
> >
> > --- net/9p/trans_virtio.c.orig 2024-10-25 10:25:09.390922517 +0800
> > +++ net/9p/trans_virtio.c 2024-10-25 16:48:40.451680192 +0800
> > @@ -31,11 +31,12 @@
> > #include <net/9p/transport.h>
> > #include <linux/scatterlist.h>
> > #include <linux/swap.h>
> > +#include <linux/thread_info.h>
> > #include <linux/virtio.h>
> > #include <linux/virtio_9p.h>
> > #include "trans_common.h"
> >
> > -#define VIRTQUEUE_NUM 128
> > +#define VIRTQUEUE_NUM (1 << (THREAD_SIZE_ORDER + PAGE_SHIFT - 6))
>
> (FWIW that turned out to be 256 on my system)
Guan,
it took me a bit to understand why you would change this constant depending on
maximum stack size, as it is not obvious. Looks like you made this because of
this comment (net/9p/trans_virtio.c):
struct virtio_chan {
...
/* Scatterlist: can be too big for stack. */
struct scatterlist sg[VIRTQUEUE_NUM];
...
};
However the stack size is not the limiting factor. It's a bit more complicated
than that:
I have also been working on increasing performance by allowing larger 9p
message size and made it user-configurable at runtime. Here is the latest
version of my patch set:
https://lore.kernel.org/all/cover.1657636554.git.linux_oss@crudebyte.com/
Patches 8..11 have already been merged. Patches 1..7 are still to be merged.
/Christian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
2024-10-26 9:36 ` Christian Schoenebeck
@ 2024-10-26 10:14 ` Guan Xin
2024-10-27 13:11 ` Christian Schoenebeck
1 sibling, 0 replies; 6+ messages in thread
From: Guan Xin @ 2024-10-26 10:14 UTC (permalink / raw)
To: Christian Schoenebeck
Cc: Dominique Martinet, v9fs, Linux Kernel Network Developers,
linux-fsdevel, Eric Van Hensbergen
Hi Christian,
On Sat, Oct 26, 2024 at 5:36 PM Christian Schoenebeck
<linux_oss@crudebyte.com> wrote:
>
> Guan,
>
> it took me a bit to understand why you would change this constant depending on
> maximum stack size, as it is not obvious. Looks like you made this because of
> this comment (net/9p/trans_virtio.c):
>
> struct virtio_chan {
> ...
> /* Scatterlist: can be too big for stack. */
> struct scatterlist sg[VIRTQUEUE_NUM];
> ...
> };
Yes, exactly.
> However the stack size is not the limiting factor. It's a bit more complicated
> than that:
>
> I have also been working on increasing performance by allowing larger 9p
> message size and made it user-configurable at runtime. Here is the latest
> version of my patch set:
>
> https://lore.kernel.org/all/cover.1657636554.git.linux_oss@crudebyte.com/
>
> Patches 8..11 have already been merged. Patches 1..7 are still to be merged.
>
> /Christian
That would be better! I'll take a look at your patches.
Please ignore my patch for the moment.
Guan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size
2024-10-26 9:36 ` Christian Schoenebeck
2024-10-26 10:14 ` Guan Xin
@ 2024-10-27 13:11 ` Christian Schoenebeck
1 sibling, 0 replies; 6+ messages in thread
From: Christian Schoenebeck @ 2024-10-27 13:11 UTC (permalink / raw)
To: Guan Xin, Dominique Martinet
Cc: v9fs, Linux Kernel Network Developers, linux-fsdevel,
Eric Van Hensbergen
On Saturday, October 26, 2024 11:36:13 AM CET Christian Schoenebeck wrote:
[...]
> I have also been working on increasing performance by allowing larger 9p
> message size and made it user-configurable at runtime. Here is the latest
> version of my patch set:
>
> https://lore.kernel.org/all/cover.1657636554.git.linux_oss@crudebyte.com/
>
> Patches 8..11 have already been merged. Patches 1..7 are still to be merged.
Sorry, it's been a while, I linked the wrong version of this patch set (v5).
Latest version is actually v6 here:
https://lore.kernel.org/all/cover.1657920926.git.linux_oss@crudebyte.com/
Accordingly patches 7..11 (of v6) have already been merged, whereas patches
1..6 are not merged yet.
/Christian
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-27 13:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 16:18 Calculate VIRTQUEUE_NUM in "net/9p/trans_virtio.c" from stack size Guan Xin
2024-10-25 21:52 ` Dominique Martinet
2024-10-26 7:07 ` [PATCH] " Guan Xin
2024-10-26 9:36 ` Christian Schoenebeck
2024-10-26 10:14 ` Guan Xin
2024-10-27 13:11 ` Christian Schoenebeck
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).