From: Stefan Hajnoczi <stefanha@redhat.com> To: virtio-fs@redhat.com, qemu-devel@nongnu.org Cc: Liu Bo <bo.liu@linux.alibaba.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 4/4] virtiofsd: add --thread-pool-size=NUM option Date: Thu, 1 Aug 2019 17:54:09 +0100 [thread overview] Message-ID: <20190801165409.20121-5-stefanha@redhat.com> (raw) In-Reply-To: <20190801165409.20121-1-stefanha@redhat.com> Add an option to control the size of the thread pool. Requests are now processed in parallel by default. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- contrib/virtiofsd/fuse_i.h | 1 + contrib/virtiofsd/fuse_lowlevel.c | 8 ++++++-- contrib/virtiofsd/fuse_virtio.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/contrib/virtiofsd/fuse_i.h b/contrib/virtiofsd/fuse_i.h index dcde9feb97..5c82cf2eac 100644 --- a/contrib/virtiofsd/fuse_i.h +++ b/contrib/virtiofsd/fuse_i.h @@ -74,6 +74,7 @@ struct fuse_session { int vu_listen_fd; int vu_socketfd; struct fv_VuDev *virtio_dev; + int thread_pool_size; }; struct fuse_chan { diff --git a/contrib/virtiofsd/fuse_lowlevel.c b/contrib/virtiofsd/fuse_lowlevel.c index 483a1bc9be..b692791fbc 100644 --- a/contrib/virtiofsd/fuse_lowlevel.c +++ b/contrib/virtiofsd/fuse_lowlevel.c @@ -26,7 +26,7 @@ #include <assert.h> #include <sys/file.h> - +#define THREAD_POOL_SIZE 64 #define OFFSET_MAX 0x7fffffffffffffffLL @@ -2556,6 +2556,7 @@ static const struct fuse_opt fuse_ll_opts[] = { LL_OPTION("--socket-path=%s", vu_socket_path, 0), LL_OPTION("vhost_user_socket=%s", vu_socket_path, 0), LL_OPTION("--fd=%d", vu_listen_fd, 0), + LL_OPTION("--thread-pool-size=%d", thread_pool_size, 0), FUSE_OPT_END }; @@ -2575,7 +2576,9 @@ void fuse_lowlevel_help(void) " --socket-path=PATH path for the vhost-user socket\n" " -o vhost_user_socket=PATH path for the vhost-user socket\n" " --fd=FDNUM fd number of vhost-user socket\n" -" -o auto_unmount auto unmount on process termination\n"); +" -o auto_unmount auto unmount on process termination\n" +" --thread-pool-size=NUM thread pool size limit (default %d)\n", + THREAD_POOL_SIZE); } void fuse_session_destroy(struct fuse_session *se) @@ -2629,6 +2632,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args, } se->fd = -1; se->vu_listen_fd = -1; + se->thread_pool_size = THREAD_POOL_SIZE; se->conn.max_write = UINT_MAX; se->conn.max_readahead = UINT_MAX; diff --git a/contrib/virtiofsd/fuse_virtio.c b/contrib/virtiofsd/fuse_virtio.c index 0c52911144..e13b3cc2e6 100644 --- a/contrib/virtiofsd/fuse_virtio.c +++ b/contrib/virtiofsd/fuse_virtio.c @@ -663,8 +663,8 @@ static void *fv_queue_thread(void *opaque) struct fuse_session *se = qi->virtio_dev->se; GThreadPool *pool; - pool = g_thread_pool_new(fv_queue_worker, qi, 1 /* TODO max_threads */, - TRUE, NULL); + pool = g_thread_pool_new(fv_queue_worker, qi, se->thread_pool_size, + TRUE, NULL); if (!pool) { fuse_err("%s: g_thread_pool_new failed\n", __func__); return NULL; -- 2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Hajnoczi <stefanha@redhat.com> To: virtio-fs@redhat.com, qemu-devel@nongnu.org Subject: [Virtio-fs] [PATCH 4/4] virtiofsd: add --thread-pool-size=NUM option Date: Thu, 1 Aug 2019 17:54:09 +0100 [thread overview] Message-ID: <20190801165409.20121-5-stefanha@redhat.com> (raw) In-Reply-To: <20190801165409.20121-1-stefanha@redhat.com> Add an option to control the size of the thread pool. Requests are now processed in parallel by default. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- contrib/virtiofsd/fuse_i.h | 1 + contrib/virtiofsd/fuse_lowlevel.c | 8 ++++++-- contrib/virtiofsd/fuse_virtio.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/contrib/virtiofsd/fuse_i.h b/contrib/virtiofsd/fuse_i.h index dcde9feb97..5c82cf2eac 100644 --- a/contrib/virtiofsd/fuse_i.h +++ b/contrib/virtiofsd/fuse_i.h @@ -74,6 +74,7 @@ struct fuse_session { int vu_listen_fd; int vu_socketfd; struct fv_VuDev *virtio_dev; + int thread_pool_size; }; struct fuse_chan { diff --git a/contrib/virtiofsd/fuse_lowlevel.c b/contrib/virtiofsd/fuse_lowlevel.c index 483a1bc9be..b692791fbc 100644 --- a/contrib/virtiofsd/fuse_lowlevel.c +++ b/contrib/virtiofsd/fuse_lowlevel.c @@ -26,7 +26,7 @@ #include <assert.h> #include <sys/file.h> - +#define THREAD_POOL_SIZE 64 #define OFFSET_MAX 0x7fffffffffffffffLL @@ -2556,6 +2556,7 @@ static const struct fuse_opt fuse_ll_opts[] = { LL_OPTION("--socket-path=%s", vu_socket_path, 0), LL_OPTION("vhost_user_socket=%s", vu_socket_path, 0), LL_OPTION("--fd=%d", vu_listen_fd, 0), + LL_OPTION("--thread-pool-size=%d", thread_pool_size, 0), FUSE_OPT_END }; @@ -2575,7 +2576,9 @@ void fuse_lowlevel_help(void) " --socket-path=PATH path for the vhost-user socket\n" " -o vhost_user_socket=PATH path for the vhost-user socket\n" " --fd=FDNUM fd number of vhost-user socket\n" -" -o auto_unmount auto unmount on process termination\n"); +" -o auto_unmount auto unmount on process termination\n" +" --thread-pool-size=NUM thread pool size limit (default %d)\n", + THREAD_POOL_SIZE); } void fuse_session_destroy(struct fuse_session *se) @@ -2629,6 +2632,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args, } se->fd = -1; se->vu_listen_fd = -1; + se->thread_pool_size = THREAD_POOL_SIZE; se->conn.max_write = UINT_MAX; se->conn.max_readahead = UINT_MAX; diff --git a/contrib/virtiofsd/fuse_virtio.c b/contrib/virtiofsd/fuse_virtio.c index 0c52911144..e13b3cc2e6 100644 --- a/contrib/virtiofsd/fuse_virtio.c +++ b/contrib/virtiofsd/fuse_virtio.c @@ -663,8 +663,8 @@ static void *fv_queue_thread(void *opaque) struct fuse_session *se = qi->virtio_dev->se; GThreadPool *pool; - pool = g_thread_pool_new(fv_queue_worker, qi, 1 /* TODO max_threads */, - TRUE, NULL); + pool = g_thread_pool_new(fv_queue_worker, qi, se->thread_pool_size, + TRUE, NULL); if (!pool) { fuse_err("%s: g_thread_pool_new failed\n", __func__); return NULL; -- 2.21.0
next prev parent reply other threads:[~2019-08-01 17:07 UTC|newest] Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-01 16:54 [Qemu-devel] [PATCH 0/4] virtiofsd: multithreading preparation part 3 Stefan Hajnoczi 2019-08-01 16:54 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-01 16:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: process requests in a thread pool Stefan Hajnoczi 2019-08-01 16:54 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-05 12:02 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-05 12:02 ` [Virtio-fs] " Dr. David Alan Gilbert 2019-08-07 9:35 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-07 9:35 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-01 16:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races Stefan Hajnoczi 2019-08-01 16:54 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-05 12:26 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-05 12:26 ` [Virtio-fs] " Dr. David Alan Gilbert 2019-08-01 16:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: fix lo_destroy() resource leaks Stefan Hajnoczi 2019-08-01 16:54 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-05 15:17 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-05 15:17 ` [Virtio-fs] " Dr. David Alan Gilbert 2019-08-05 18:57 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-05 18:57 ` [Virtio-fs] " Dr. David Alan Gilbert 2019-08-06 18:58 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-06 18:58 ` [Virtio-fs] " Dr. David Alan Gilbert 2019-08-07 9:41 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-07 9:41 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-01 16:54 ` Stefan Hajnoczi [this message] 2019-08-01 16:54 ` [Virtio-fs] [PATCH 4/4] virtiofsd: add --thread-pool-size=NUM option Stefan Hajnoczi 2019-08-05 2:52 ` [Qemu-devel] [Virtio-fs] [PATCH 0/4] virtiofsd: multithreading preparation part 3 piaojun 2019-08-05 2:52 ` piaojun 2019-08-05 8:01 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-05 8:01 ` [Virtio-fs] [Qemu-devel] " Stefan Hajnoczi 2019-08-05 9:40 ` [Qemu-devel] [Virtio-fs] " piaojun 2019-08-05 9:40 ` [Virtio-fs] [Qemu-devel] " piaojun 2019-08-07 18:03 ` Stefan Hajnoczi 2019-08-07 18:03 ` [Virtio-fs] " Stefan Hajnoczi 2019-08-07 20:57 ` [Qemu-devel] " Vivek Goyal 2019-08-07 20:57 ` Vivek Goyal 2019-08-08 9:02 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-08 9:02 ` Stefan Hajnoczi 2019-08-08 9:53 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-08 9:53 ` Dr. David Alan Gilbert 2019-08-08 12:53 ` [Qemu-devel] " Vivek Goyal 2019-08-08 12:53 ` Vivek Goyal 2019-08-09 8:23 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-09 8:23 ` Stefan Hajnoczi 2019-08-10 21:35 ` [Qemu-devel] " Liu Bo 2019-08-10 21:35 ` Liu Bo 2019-08-09 8:21 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-09 8:21 ` Stefan Hajnoczi 2019-08-10 21:34 ` [Qemu-devel] " Liu Bo 2019-08-10 21:34 ` Liu Bo 2019-08-11 2:26 ` [Qemu-devel] " piaojun 2019-08-11 2:26 ` piaojun 2019-08-12 10:05 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-12 10:05 ` Stefan Hajnoczi 2019-08-12 11:58 ` [Qemu-devel] " piaojun 2019-08-12 11:58 ` piaojun 2019-08-12 12:51 ` [Qemu-devel] " Dr. David Alan Gilbert 2019-08-12 12:51 ` Dr. David Alan Gilbert 2019-08-08 8:10 ` [Qemu-devel] " piaojun 2019-08-08 8:10 ` piaojun 2019-08-08 9:53 ` [Qemu-devel] " Stefan Hajnoczi 2019-08-08 9:53 ` Stefan Hajnoczi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190801165409.20121-5-stefanha@redhat.com \ --to=stefanha@redhat.com \ --cc=bo.liu@linux.alibaba.com \ --cc=dgilbert@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=virtio-fs@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.