From: E.W.Z. <kreuzerkrieg at gmail.com>
To: spdk@lists.01.org
Subject: Re: [SPDK] core_mask and spawning new threads
Date: Wed, 21 Feb 2018 19:40:54 +0200 [thread overview]
Message-ID: <5a8daf25.f8aedf0a.6fae.7d87@mx.google.com> (raw)
In-Reply-To: FBE7E039FA50BF47A673AD0BD3CD56A83758CB23@HASMSX105.ger.corp.intel.com
[-- Attachment #1: Type: text/plain, Size: 3548 bytes --]
I think I’ve found a way to overcome this. In my test application when thread which were created to produce I/O were spawned from the “main” thread in which the SPDK was initialized. Of course the cpu mask given to SPDK environment was affecting affinity of thread I was creating. So I tried to do the following, create a temporary thread, in this thread create an instance of my object which instantiates the SPDK environment, and then the temporary thread is destroyed and I have fully working SPDK machinery (which in turn spawned its own threads affected by affinity set in SPDK initialization) with threads doing IO created from main thread, which, in turn, knows nothing about SPDK machinery and its affinity. It successfully completed the run. Looks like a hack, but working as intended. What do you say?
Sent from Mail for Windows 10
From: Stojaczyk, DariuszX
Sent: Wednesday, February 21, 2018 5:33 PM
To: Storage Performance Development Kit
Subject: Re: [SPDK] core_mask and spawning new threads
> in case I'm integrating the SPDK into my existing application, I have to change the way I'm spawning thread in the whole application, right?
That's correct.
Regards,
D.
From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Ernest Zed
Sent: Wednesday, February 21, 2018 1:18 PM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: Re: [SPDK] core_mask and spawning new threads
Thanks for the explanation. Just to make it clear, in case I'm integrating the SPDK into my existing application, I have to change the way I'm spawning thread in the whole application, right?
Sincerely,
E.
On Wed, Feb 21, 2018 at 1:43 PM, Stojaczyk, DariuszX <dariuszx.stojaczyk(a)intel.com> wrote:
Hi Ernest,
This is expected behavior. SPDK starts a fixed number of affinitized threads on startup, and the core mask parameter you've mentioned is what specifies the affinity and number of those. Each thread is bound to a single CPU. The one thread that called `spdk_env_init` becomes a master thread and is affinitized to the `opts.master_core`. To spawn additional POSIX threads from any SPDK-affinitized thread, you should use `spdk_call_unaffinitized()` (include/spdk/env.h).
(There's also an `spdk_unaffinitize_thread()`, but it's restricted to very specific workloads and probably shouldn't be used at all.)
Best regards,
D.
From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Ernest Zed
Sent: Wednesday, February 21, 2018 10:47 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: [SPDK] core_mask and spawning new threads
Hi all,
I see that all threads I create within my application are running on the same core. Looks like core_mask is the right parameter to adjust, however I dont see core usage affected by changing the core_mask on spdk_env_opts
The code:
spdk_env_opts opts;
spdk_env_opts_init(&opts);
opts.name = "blah";
opts.core_mask = "0xFFFF";
opts.master_core = 1;
opts.shm_id = 0;
if (spdk_env_init(&opts) < 0) {
throw std::runtime_error("Unable to initialize SPDK env");
}
Whatever value I assign to the core_mask everything runs on the same core defined in master_core. If I set affinity to my threads manually everything works as expected. Is it a spdk_env_init bug? Am I doing something wrong?
Sincerely,
Ernest
_______________________________________________
SPDK mailing list
SPDK(a)lists.01.org
https://lists.01.org/mailman/listinfo/spdk
[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 13009 bytes --]
next reply other threads:[~2018-02-21 17:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 17:40 E.W.Z. [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-02-22 8:27 [SPDK] core_mask and spawning new threads Wodkowski, PawelX
2018-02-21 17:00 E.W.Z.
2018-02-21 16:48 Walker, Benjamin
2018-02-21 16:09 Stojaczyk, DariuszX
2018-02-21 15:33 Stojaczyk, DariuszX
2018-02-21 12:18 Ernest Zed
2018-02-21 11:43 Stojaczyk, DariuszX
2018-02-21 9:46 Ernest Zed
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=5a8daf25.f8aedf0a.6fae.7d87@mx.google.com \
--to=spdk@lists.01.org \
/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.