[PATCH] net/mana: use mana_local_data for tracking usage data for primary process

Stephen Hemminger stephen at networkplumber.org
Sat Feb 8 01:21:24 CET 2025


On Fri,  7 Feb 2025 15:21:45 -0800
longli at 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.


More information about the stable mailing list