Hi Vincent,
I don't think there's any code in SPDK that reduces context switches. I would
assume it's just the system scheduler noticing that SPDK reactors are always
busy and there's not much gain interrupting them. All the tasks/threads are
scheduled to a much less occupied cpu.
The context switch rate depends entirely on how many threads you want to
run on your system at once.
There are some interesting threading changes coming to SPDK right now
that basically untie spdk_threads from system threads, allowing you to
manually poll spdk_threads from any pthread. If that's something that can
help your case, I'm pretty sure Ben Walker (+CC) can point you to some
interesting details.
D.
-----Original Message-----
From: SPDK [mailto:spdk-bounces@lists.01.org] On Behalf Of Vincent
Sent: Thursday, May 30, 2019 2:34 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: [SPDK] The context switch rate difference between the thread
created by spdk(reactor thread) and linux API pthread_create
Hello all,
We have an application that is developed in spdk environment.
In the application we create some threads by using pthread_create API.
So, in the application there are some spdk reactors threads
and some threads that is create by our own.
We found an interesting phenomenon,
we found the spdk reactor thread is rarely swap out(context switch)
And always fixed in a core to execution.
But the threads created by our own is swap out frequently.
We Know the API “sched_setaffinity” that can set thread to fix run on
particular cpu.
But it still cannot explain why the our thread is context switch frequently.
So, Our problem is "How does the spdk reactor thread can achieve so low
context switch rate??"
Is any special setting for spdk reactor threads??
Any comment is welcome.
Thank you so much
_______________________________________________
SPDK mailing list
SPDK(a)lists.01.org
https://lists.01.org/mailman/listinfo/spdk