DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Olivier Matz" <olivier.matz@6wind.com>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	"Beilei Xing" <beilei.xing@intel.com>,
	"Jingjing Wu" <jingjing.wu@intel.com>,
	"Qiming Yang" <qiming.yang@intel.com>,
	"Qi Zhang" <qi.z.zhang@intel.com>,
	"Honnappa Nagarahalli" <Honnappa.Nagarahalli@arm.com>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"Bruce Richardson" <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>
Subject: [RFC] mempool: cache preparation
Date: Fri, 21 Jan 2022 09:59:50 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D86E1A@smartserver.smartshare.dk> (raw)

Some drivers bypass the mbuf/mempool library functions, to manipulate the mempool cache directly for improved performance.

Specifically, the AVX512 implementation of some of the Intel PMDs copy an array of objects from the cache to a field in an array of some structure, i.e. it is not a 1:1 memcpy. This method avoids having to copy the array of pointers into a temporary array before copying them into the fields of the target array, and thus improves performance and reduces CPU cache pollution.

For such purposes, the mempool API could provide functions to prepare the mempool cache for a direct access operation, and commit the transaction:
1. Prepare the cache for getting N objects directly from the objs array. This function returns the address of the position in the cache array, from where the objects can be read, or NULL if failed.
2. Commit after getting the N objects.
3. Prepare the cache for putting N objects directly into the objs array. This function returns the address of the position in the cache array, to where the objects can be written, or NULL if failed.
4. Commit after putting the N objects.

The functions only need to support getting/putting exactly N objects; i.e. the "prepare" functions do not need return a value indicating some number less than N is available. Likewise, the "commit" functions do not need to support any N other than the N in the preceding "prepare" function.

This API extension would provide a clean interface to directly access the mempool cache with high performance, so copy-pasting the mempool's cache handling logic can be avoided, and bugs like [1] would not survive.

Would this be useful?

[1]: https://bugs.dpdk.org/show_bug.cgi?id=923


Med venlig hilsen / Kind regards,
-Morten Brørup


             reply	other threads:[~2022-01-21  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  8:59 Morten Brørup [this message]
2022-01-21  9:58 ` Ananyev, Konstantin

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=98CBD80474FA8B44BF855DF32C47DC35D86E1A@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=thomas@monjalon.net \
    /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).