qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* question on vhost, limiting kernel threads and NPROC
@ 2021-07-09 16:25 Mike Christie
  2021-07-12 12:05 ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Christie @ 2021-07-09 16:25 UTC (permalink / raw)
  To: libvir-list, qemu-devel, Michael S. Tsirkin, stefanha@redhat.com,
	jasowang@redhat.com, Christian Brauner

Hi,

The goal of this email is to try and figure how we want to track/limit the
number of kernel threads created by vhost devices.

Background:
-----------
For vhost-scsi, we've hit a issue where the single vhost worker thread can't
handle all IO the being sent from multiple queues. IOPs is stuck at around
500K. To fix this, we did this patchset:

https://lore.kernel.org/linux-scsi/20210525180600.6349-1-michael.christie@oracle.com/

which allows userspace to create N threads and map them to a dev's virtqueues.
With this we can get around 1.4M IOPs.

Problem:
--------
While those patches were being reviewed, a concern about tracking all these
new possible threads was raised here:

https://lore.kernel.org/linux-scsi/YL45CfpHyzSEcAJv@stefanha-x1.localdomain/

To save you some time, the question is what does other kernel code using the
kthread API do to track the number of kernel threads created on behalf of
a userspace thread. The answer is they don't do anything so we will have to
add that code.

I started to do that here:

https://lkml.org/lkml/2021/6/23/1233

where those patches would charge/check the vhost device owner's RLIMIT_NPROC
value. But, the question of if we really want to do this has come up which is
why I'm bugging lists like libvirt now.

Question/Solution:
------------------
I'm bugging everyone so we can figure out:

If we need to specifically track the number of kernel threads being made
for the vhost kernel use case by the RLIMIT_NPROC limit?

Or, is it ok to limit the number of devices with the RLIMIT_NOFILE limit.
Then each device has a limit on the number of threads it can create.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-14 20:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-09 16:25 question on vhost, limiting kernel threads and NPROC Mike Christie
2021-07-12 12:05 ` Stefan Hajnoczi
2021-09-13 17:04   ` Mike Christie
2021-09-13 21:32     ` Michael S. Tsirkin
2021-09-14 16:04       ` Christian Brauner

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).