All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: virtio-fs-list <virtio-fs@redhat.com>, Michey Mehta <mimehta@redhat.com>
Subject: Re: [Virtio-fs] [External] [RFC] [PATCH] virtiofsd: Auto switch between inline and thread-pool processing
Date: Wed, 28 Apr 2021 09:40:25 -0400	[thread overview]
Message-ID: <20210428134025.GA1840673@redhat.com> (raw)
In-Reply-To: <YIb/lcwtZWZOL1/k@work-vm>

On Mon, Apr 26, 2021 at 06:59:49PM +0100, Dr. David Alan Gilbert wrote:

[..]
> > > I can imagine something based on the % of time a thread is utilised as
> > > being an indication you might need more/less; but that's an even more
> > > complicated heuristic.
> > 
> > Yes, that's even more complicated heuristic.
> > 
> > Also not sure how to account for when thread blocks in kernel waiting for
> > I/O to finish. Thread is not keeping cpu busy but at the same time
> > can't make progress.
> 
> Does it matter if the thread is blocked due to CPU or IO?  If you can
> just look at the time the thread is non-free then that gives you a
> utilisation.

Hmm.., i guess you are right. So one way of doing this will be take
time snapshots.

t1 = gettimeofday()
thread-goes-to-sleep
thread-wakes-up
t2= gettimeofday()
thread-pops-requests
thread-processes-requests-inline
t3=gettimeofday()

So effectively t2-t1 is free time and t3-t2 is busy time. So % utilization
should be.

%util=(t3-t2) * 100/(t3-t1)

Once we swtich to thread pool, then we will also need something to go
back to inline processing. Some notion of how busy thread pool is. If
thread pool's %utilization is less then switch back to inline processing.
This bit might be more tricky because we use glib thread pool and glib
API might not provide us any of this data.

https://developer.gnome.org/glib/2.68/glib-Thread-Pools.html

I feel that heuristics based on number of requests are very simple to
implement. So may be we can implement that for now.

Thanks
Vivek


  reply	other threads:[~2021-04-28 13:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 21:11 [Virtio-fs] [RFC] [PATCH] virtiofsd: Auto switch between inline and thread-pool processing Vivek Goyal
2021-04-24  6:12 ` Liu Bo
2021-04-26 11:39   ` Vivek Goyal
2021-04-26 19:03     ` Liu Bo
2021-04-26 19:10       ` Vivek Goyal
2021-04-25  2:29 ` [Virtio-fs] [External] " Jiachen Zhang
2021-04-26 15:11   ` Vivek Goyal
2021-04-26 17:40     ` Dr. David Alan Gilbert
2021-04-26 17:51       ` Vivek Goyal
2021-04-26 17:59         ` Dr. David Alan Gilbert
2021-04-28 13:40           ` Vivek Goyal [this message]
2021-04-26 17:34 ` [Virtio-fs] " Vivek Goyal

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=20210428134025.GA1840673@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=mimehta@redhat.com \
    --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: link
Be 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.