From: Stephen Hemminger <stephen@networkplumber.org>
To: Don Wallwork <donw@xsightlabs.com>
Cc: dev@dpdk.org, mb@smartsharesystems.com,
anatoly.burakov@intel.com, dmitry.kozliuk@gmail.com,
bruce.richardson@intel.com, Honnappa.Nagarahalli@arm.com,
nd@arm.com, haiyue.wang@intel.com
Subject: Re: [PATCH v2] eal: allow worker lcore stacks to be allocated from hugepage memory
Date: Fri, 13 May 2022 14:41:26 -0700 [thread overview]
Message-ID: <20220513144126.19e37480@hermes.local> (raw)
In-Reply-To: <20220513175822.69905-1-donw@xsightlabs.com>
On Fri, 13 May 2022 13:58:22 -0400
Don Wallwork <donw@xsightlabs.com> wrote:
> + if (internal_conf->huge_worker_stack_size == 0) {
> + ret = pthread_create(&lcore_config[i].thread_id, NULL,
> + eal_thread_loop,
> + (void *)(uintptr_t)i);
> + } else {
> + /* Allocate NUMA aware stack memory and set
> + * pthread attributes
> + */
> + pthread_attr_t attr;
> + size_t stack_size;
> + void *stack_ptr;
> +
> + if (pthread_attr_init(&attr) != 0) {
> + rte_eal_init_alert("Cannot init pthread "
> + "attributes");
> + rte_errno = EFAULT;
> + return -1;
> + }
> + if (internal_conf->huge_worker_stack_size ==
> + USE_OS_STACK_SIZE) {
> + if (pthread_attr_getstacksize(&attr,
> + &stack_size) != 0) {
> + rte_errno = EFAULT;
> + return -1;
> + }
> + } else {
> + stack_size =
> + internal_conf->huge_worker_stack_size;
> + }
> + stack_ptr =
> + rte_zmalloc_socket("lcore_stack",
> + stack_size,
> + stack_size,
> + rte_lcore_to_socket_id(i));
> +
> + if (stack_ptr == NULL) {
> + rte_eal_init_alert("Cannot allocate stack "
> + "memory for worker lcore");
> + rte_errno = ENOMEM;
> + return -1;
> + }
> +
> + if (pthread_attr_setstack(&attr,
> + stack_ptr,
> + stack_size) != 0) {
> + rte_eal_init_alert("Cannot set pthread "
> + "stack attributes");
> + rte_errno = EFAULT;
> + return -1;
> + }
> +
> + /* create a thread for each lcore */
> + ret = pthread_create(&lcore_config[i].thread_id, &attr,
> + eal_thread_loop,
> + (void *)(uintptr_t)i);
> +
> + if (pthread_attr_destroy(&attr) != 0) {
> + rte_eal_init_alert("Cannot destroy pthread "
> + "attributes");
> + rte_errno = EFAULT;
> + return -1;
> + }
The indentation is getting kind of deep here, and to me that indicates
a good place to split this into a helper function?
next prev parent reply other threads:[~2022-05-13 21:41 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 14:10 [PATCH] " Don Wallwork
2022-05-03 6:10 ` Morten Brørup
2022-05-03 13:08 ` Wang, Haiyue
2022-05-03 19:46 ` Don Wallwork
2022-05-04 3:08 ` Wang, Haiyue
2022-05-13 17:58 ` [PATCH v2] " Don Wallwork
2022-05-13 21:38 ` Stephen Hemminger
2022-05-16 19:43 ` Don Wallwork
2022-05-13 21:41 ` Stephen Hemminger [this message]
2022-05-14 3:31 ` fengchengwen
2022-05-16 19:47 ` Don Wallwork
2022-05-17 6:28 ` Morten Brørup
2022-05-16 19:50 ` [PATCH v3] " Don Wallwork
2022-05-16 20:28 ` Stephen Hemminger
2022-05-16 20:29 ` Don Wallwork
2022-05-17 15:31 ` [PATCH v4] " Don Wallwork
2022-05-17 15:56 ` Stephen Hemminger
2022-05-18 14:10 ` Don Wallwork
2022-05-20 8:30 ` fengchengwen
2022-05-23 22:35 ` Kathleen Capella
2022-05-24 13:48 ` Don Wallwork
2022-05-24 14:40 ` Burakov, Anatoly
2022-05-24 19:38 ` Don Wallwork
2022-05-24 19:46 ` [PATCH v5] " Don Wallwork
2022-05-24 19:51 ` [PATCH v6] " Don Wallwork
2022-06-01 0:05 ` Kathleen Capella
2022-06-20 8:35 ` David Marchand
2022-06-21 10:37 ` Thomas Monjalon
2022-06-21 12:31 ` Don Wallwork
2022-06-21 14:42 ` Thomas Monjalon
2022-06-21 14:52 ` Don Wallwork
2022-06-21 15:00 ` Thomas Monjalon
2022-06-21 16:32 ` Honnappa Nagarahalli
2022-06-21 19:33 ` David Marchand
2022-06-23 11:21 ` [PATCH v7] " Don Wallwork
2022-06-23 20:32 ` David Marchand
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=20220513144126.19e37480@hermes.local \
--to=stephen@networkplumber.org \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=donw@xsightlabs.com \
--cc=haiyue.wang@intel.com \
--cc=mb@smartsharesystems.com \
--cc=nd@arm.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 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).