DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wathsala Vithanage <wathsala.vithanage@arm.com>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	dev@dpdk.org,
	"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>
Cc: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: Re: [PATCH v2] ring: add cache guard after ring elements table
Date: Mon, 11 May 2026 18:29:33 -0500	[thread overview]
Message-ID: <4d381ed2-5e7c-4f91-a414-7b374f453616@arm.com> (raw)
In-Reply-To: <20260505161329.258182-1-mb@smartsharesystems.com>

Acked-by: Wathsala Vithanage <wathsala.vithanage@arm.com>

On 5/5/26 11:13, Morten Brørup wrote:
> Added cache guard after the table holding the ring elements, to avoid
> false sharing conflicts caused by next-line hardware prefetchers when
> accessing elements at the end of the ring table.
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> ---
> v2:
> * Added comment describing reason for padding. (Konstantin)
> ---
>   lib/ring/rte_ring.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
> index f10050a1c4..10b52dc679 100644
> --- a/lib/ring/rte_ring.c
> +++ b/lib/ring/rte_ring.c
> @@ -73,8 +73,15 @@ rte_ring_get_memsize_elem(unsigned int esize, unsigned int count)
>   		return -EINVAL;
>   	}
>   
> +	static_assert(sizeof(struct rte_ring) == RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_ring)),
> +			"Size of struct rte_ring not cache line aligned");
>   	sz = sizeof(struct rte_ring) + (ssize_t)count * esize;
> +	/* Add padding, to guard against false sharing-like effects
> +	 * on systems with a next-N-lines hardware prefetcher, when
> +	 * accessing elements at the end of the ring table.
> +	 */
>   	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
> +	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;
>   	return sz;
>   }
>   

      parent reply	other threads:[~2026-05-11 23:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 10:23 [PATCH] ring: add cache guard after ring elements table Morten Brørup
2026-04-21 17:04 ` Morten Brørup
2026-04-30 17:22 ` Konstantin Ananyev
2026-04-30 18:34   ` Morten Brørup
2026-05-04 12:55     ` Konstantin Ananyev
2026-05-04 13:17       ` Morten Brørup
2026-05-05  7:47         ` Konstantin Ananyev
2026-05-05  8:18           ` Morten Brørup
2026-05-05  9:05             ` Konstantin Ananyev
2026-05-05 16:13 ` [PATCH v2] " Morten Brørup
2026-05-06  1:04   ` fengchengwen
2026-05-11 23:29   ` Wathsala Vithanage [this message]

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=4d381ed2-5e7c-4f91-a414-7b374f453616@arm.com \
    --to=wathsala.vithanage@arm.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=mb@smartsharesystems.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