virtiofsd: Used glib "shared" thread pool

glib offers thread pools and it seems to support "exclusive" and "shared"
thread pools.

https://developer.gnome.org/glib/stable/glib-Thread-Pools.html#g-thread-pool-new

Currently we use "exlusive" thread pools but its performance seems to be
poor. I tried using "shared" thread pools and performance seems much
better. I posted performance results here.

https://www.redhat.com/archives/virtio-fs/2020-September/msg00080.html

So lets switch to shared thread pools. We can think of making it optional
once somebody can show in what cases exclusive thread pools offer better
results. For now, my simple performance tests across the board see
better results with shared thread pools.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Message-Id: <20200921213216.GE13362@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  With seccomp fix from Miklos
This commit is contained in:
Vivek Goyal 2020-09-21 17:32:16 -04:00 committed by Dr. David Alan Gilbert
parent f1303afe22
commit 04d325e86f
2 changed files with 3 additions and 1 deletions

View File

@ -588,7 +588,7 @@ static void *fv_queue_thread(void *opaque)
struct fuse_session *se = qi->virtio_dev->se; struct fuse_session *se = qi->virtio_dev->se;
GThreadPool *pool; GThreadPool *pool;
pool = g_thread_pool_new(fv_queue_worker, qi, se->thread_pool_size, TRUE, pool = g_thread_pool_new(fv_queue_worker, qi, se->thread_pool_size, FALSE,
NULL); NULL);
if (!pool) { if (!pool) {
fuse_log(FUSE_LOG_ERR, "%s: g_thread_pool_new failed\n", __func__); fuse_log(FUSE_LOG_ERR, "%s: g_thread_pool_new failed\n", __func__);

View File

@ -93,6 +93,8 @@ static const int syscall_whitelist[] = {
SCMP_SYS(rt_sigaction), SCMP_SYS(rt_sigaction),
SCMP_SYS(rt_sigprocmask), SCMP_SYS(rt_sigprocmask),
SCMP_SYS(rt_sigreturn), SCMP_SYS(rt_sigreturn),
SCMP_SYS(sched_getattr),
SCMP_SYS(sched_setattr),
SCMP_SYS(sendmsg), SCMP_SYS(sendmsg),
SCMP_SYS(setresgid), SCMP_SYS(setresgid),
SCMP_SYS(setresuid), SCMP_SYS(setresuid),