All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: longli@linuxonhyperv.com
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Wei Hu <weh@microsoft.com>,
	dev@dpdk.org, Long Li <longli@microsoft.com>,
	stable@dpdk.org
Subject: Re: [PATCH] net/mana: use mana_local_data for tracking usage data for primary process
Date: Fri, 7 Feb 2025 16:21:24 -0800	[thread overview]
Message-ID: <20250207162124.112f0c00@hermes.local> (raw)
In-Reply-To: <1738970505-7864-1-git-send-email-longli@linuxonhyperv.com>

On Fri,  7 Feb 2025 15:21:45 -0800
longli@linuxonhyperv.com wrote:

> +	/* At least one eth_dev is probed, init shared data */
> +	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> +		rte_spinlock_lock(&mana_shared_data_lock);
> +		mana_local_data.primary_cnt++;
> +		rte_spinlock_unlock(&mana_shared_data_lock);
> +	} else {
> +		rte_spinlock_lock(&mana_shared_data_lock);
> +		mana_local_data.secondary_cnt++;
> +		rte_spinlock_unlock(&mana_shared_data_lock);
> +
> +		rte_spinlock_lock(&mana_shared_data->lock);
> +		mana_shared_data->secondary_cnt++;
> +		rte_spinlock_unlock(&mana_shared_data->lock);

If all you are doing is wanting a MP safe counter, use atomic operations
instead of the overhead of a spin lock.

  reply	other threads:[~2025-02-08  0:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 23:21 [PATCH] net/mana: use mana_local_data for tracking usage data for primary process longli
2025-02-08  0:21 ` Stephen Hemminger [this message]
2025-02-08  1:40   ` [EXTERNAL] " Long Li

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=20250207162124.112f0c00@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=longli@linuxonhyperv.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    --cc=weh@microsoft.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 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.