Thanks, I already checked this document, as well as the one Benjamin provided. I resorted to more C++-ish solution using promise/future, which was mentioned in Bejamin’s link

 

 

Sent from Mail for Windows 10

 

From: Stojaczyk, DariuszX
Sent: Wednesday, February 21, 2018 6:09 PM
To: Storage Performance Development Kit
Subject: Re: [SPDK] core_mask and spawning new threads

 

For integrating your application further with SPDK, you might also want to check the following document:

 

http://www.spdk.io/doc/event.html

 

Regards,

D.

 

From: SPDK [mailto:spdk-bounces@lists.01.org] On Behalf Of Stojaczyk, DariuszX
Sent: Wednesday, February 21, 2018 4:34 PM
To: Storage Performance Development Kit <spdk@lists.01.org>
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@lists.01.org] On Behalf Of Ernest Zed
Sent: Wednesday, February 21, 2018 1:18 PM
To: Storage Performance Development Kit <spdk@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@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@lists.01.org] On Behalf Of Ernest Zed
Sent: Wednesday, February 21, 2018 10:47 AM
To: Storage Performance Development Kit <spdk@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@lists.01.org
https://lists.01.org/mailman/listinfo/spdk