From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: Don Wallwork <donw@xsightlabs.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: nd <nd@arm.com>, nd <nd@arm.com>
Subject: RE: [RFC] eal: allow worker lcore stacks to be allocated from hugepage memory
Date: Wed, 27 Apr 2022 00:42:13 +0000 [thread overview]
Message-ID: <DBAPR08MB581490A9837565B332E360E698FA9@DBAPR08MB5814.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20220426122000.24743-1-donw@xsightlabs.com>
<snip>
>
> Add support for using hugepages for worker lcore stack memory. The intent is
> to improve performance by reducing stack memory related TLB misses and also
> by using memory local to the NUMA node of each lcore.
This is a good idea. Have you measured any performance differences with this patch? What kind of benefits do you see?
>
> Platforms desiring to make use of this capability must enable the associated
> option flag and stack size settings in platform config files.
> ---
> lib/eal/linux/eal.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index
> 1ef263434a..4e1e5b6915 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1143,9 +1143,48 @@ rte_eal_init(int argc, char **argv)
>
> lcore_config[i].state = WAIT;
>
> +#ifdef RTE_EAL_NUMA_AWARE_LCORE_STACK
> + /* Allocate NUMA aware stack memory and set pthread
> attributes */
> + pthread_attr_t attr;
> + void *stack_ptr =
> + rte_zmalloc_socket("lcore_stack",
> +
> RTE_EAL_NUMA_AWARE_LCORE_STACK_SIZE,
> +
> RTE_EAL_NUMA_AWARE_LCORE_STACK_SIZE,
> + rte_lcore_to_socket_id(i));
> +
> + if (stack_ptr == NULL) {
> + rte_eal_init_alert("Cannot allocate stack memory");
May be worth adding more details to the error message, like lcore id.
> + rte_errno = ENOMEM;
> + return -1;
> + }
> +
> + if (pthread_attr_init(&attr) != 0) {
> + rte_eal_init_alert("Cannot init pthread attributes");
> + rte_errno = EINVAL;
EFAULT would be better.
> + return -1;
> + }
> + if (pthread_attr_setstack(&attr,
> + stack_ptr,
> +
> RTE_EAL_NUMA_AWARE_LCORE_STACK_SIZE) != 0) {
> + rte_eal_init_alert("Cannot set pthread stack
> attributes");
> + rte_errno = ENOTSUP;
EFAULT would be better.
> + 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;
> + }
> +#else
> /* create a thread for each lcore */
> ret = pthread_create(&lcore_config[i].thread_id, NULL,
> eal_thread_loop, (void *)(uintptr_t)i);
> +#endif
> if (ret != 0)
> rte_panic("Cannot create thread\n");
>
> --
> 2.17.1
next prev parent reply other threads:[~2022-04-27 0:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-26 12:19 Don Wallwork
2022-04-26 14:58 ` Stephen Hemminger
2022-04-26 21:01 ` Don Wallwork
2022-04-26 21:21 ` Stephen Hemminger
2022-04-26 21:25 ` Don Wallwork
2022-04-27 8:17 ` Morten Brørup
2022-04-29 18:52 ` Don Wallwork
2022-04-29 19:03 ` Stephen Hemminger
2022-05-02 13:15 ` Don Wallwork
2022-04-30 7:55 ` Morten Brørup
2022-04-27 0:42 ` Honnappa Nagarahalli [this message]
2022-04-27 17:50 ` Don Wallwork
2022-04-27 19:09 ` Honnappa Nagarahalli
2022-04-29 20:00 ` [RFC v2] " Don Wallwork
2022-04-30 7:20 ` Morten Brørup
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=DBAPR08MB581490A9837565B332E360E698FA9@DBAPR08MB5814.eurprd08.prod.outlook.com \
--to=honnappa.nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=donw@xsightlabs.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).