DPDK patches and discussions
 help / color / mirror / Atom feed
From: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
To: "Abdullah Ömer Yamaç" <aomeryamac@gmail.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, nd <nd@arm.com>
Subject: Re: [PATCH v2] lib/hash: feature reclaim defer queue
Date: Sun, 3 Mar 2024 19:14:00 +0000	[thread overview]
Message-ID: <68684A5E-2746-4789-AA6C-7FF09FDC785B@arm.com> (raw)
In-Reply-To: <20240302212711.204396-1-aomeryamac@gmail.com>

Hello Abdullah,
	Thank you for the patch, few comments inline.

The short commit log could be changed as follows:

"lib/hash: add defer queue reclaim API”

> On Mar 2, 2024, at 3:27 PM, Abdullah Ömer Yamaç <aomeryamac@gmail.com> wrote:
> 
> This patch adds a new feature to the hash library to allow the user to
> reclaim the defer queue. This is useful when the user wants to force
> reclaim resources that are not being used. This API is only available
> if the RCU is enabled.
> 
> Signed-off-by: Abdullah Ömer Yamaç <aomeryamac@gmail.com>
> Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Please add this only after you get an explicit Ack on the patch.

> ---
> lib/hash/rte_cuckoo_hash.c | 23 +++++++++++++++++++++++
> lib/hash/rte_hash.h        | 14 ++++++++++++++
> lib/hash/version.map       |  7 +++++++
> 3 files changed, 44 insertions(+)
> 
> diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
> index 9cf94645f6..254fa80cc5 100644
> --- a/lib/hash/rte_cuckoo_hash.c
> +++ b/lib/hash/rte_cuckoo_hash.c
> @@ -1588,6 +1588,27 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)
> return 0;
> }
> 
> +int
> +rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h)
We need to add freed, pending and available parameters to this API. I think this information will be helpful for the users. For ex: in your use case, you could use the pending value to calculate the available hash entries.

> +{
> + int ret;
> +
> + if (h->hash_rcu_cfg == NULL || h->dq == NULL) {
We can skip NULL check for h->dq as the RCU reclaim API makes the same check.

> + rte_errno = EINVAL;
> + return -1;
> + }
> +
> + ret = rte_rcu_qsbr_dq_reclaim(h->dq, h->hash_rcu_cfg->max_reclaim_size, NULL, NULL, NULL);
> + if (ret != 0) {
> + HASH_LOG(ERR,
> + "%s: could not reclaim the defer queue in hash table",
> + __func__);
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> static inline void
> remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt,
> unsigned int i)
> diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h
> index 7ecc021111..c119477d50 100644
> --- a/lib/hash/rte_hash.h
> +++ b/lib/hash/rte_hash.h
> @@ -674,6 +674,21 @@ rte_hash_iterate(const struct rte_hash *h, const void **key, void **data, uint32
>  */
> int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg);
> 
> +/**
> + * Reclaim resources from the defer queue.
> + * This API reclaim the resources from the defer queue if rcu is enabled.
> + *
> + * @param h
> + *   the hash object to reclaim resources
> + * @return
> + *   On success - 0
> + *   On error - 1 with error code set in rte_errno.
> + *   Possible rte_errno codes are:
> + *   - EINVAL - invalid pointer or invalid rcu mode
We can remove the ‘invalid rcd mode’.

> + */
> +__rte_experimental
> +int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/lib/hash/version.map b/lib/hash/version.map
> index 6b2afebf6b..cec0e8fc67 100644
> --- a/lib/hash/version.map
> +++ b/lib/hash/version.map
> @@ -48,3 +48,9 @@ DPDK_24 {
> 
> local: *;
> };
> +
> +EXPERIMENTAL {
> + global:
> +
> + rte_hash_rcu_qsbr_dq_reclaim;
> +}
> \ No newline at end of file
> -- 
> 2.34.1
> 


  reply	other threads:[~2024-03-03 19:14 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 15:33 [PATCH] lib/hash,lib/rcu: feature hidden key count in hash Abdullah Ömer Yamaç
2024-02-16 12:41 ` Thomas Monjalon
2024-02-19 17:36 ` Medvedkin, Vladimir
2024-02-19 21:28   ` Abdullah Ömer Yamaç
2024-02-19 23:35     ` Honnappa Nagarahalli
2024-02-20 18:58       ` Abdullah Ömer Yamaç
2024-02-21  3:23         ` Honnappa Nagarahalli
2024-02-21 21:51           ` Abdullah Ömer Yamaç
2024-02-22  2:37             ` Honnappa Nagarahalli
2024-02-22 12:39               ` Abdullah Ömer Yamaç
2024-02-22 16:44                 ` Honnappa Nagarahalli
2024-02-28 11:44                   ` Abdullah Ömer Yamaç
2024-02-28 14:51                     ` Honnappa Nagarahalli
2024-03-02 20:22                       ` Abdullah Ömer Yamaç
2024-03-02 21:08                         ` [PATCH v2] lib/hash: feature reclaim defer queue Abdullah Ömer Yamaç
2024-03-02 21:27                           ` Abdullah Ömer Yamaç
2024-03-03 19:14                             ` Honnappa Nagarahalli [this message]
2024-03-04  8:27                               ` Abdullah Ömer Yamaç
2024-03-04 21:58                                 ` Honnappa Nagarahalli
2024-03-06  8:55                                   ` [PATCH v3] lib/hash: add defer queue reclaim API Abdullah Ömer Yamaç
2024-03-06  8:59                                   ` Abdullah Ömer Yamaç
2024-03-06 10:13                                   ` Abdullah Ömer Yamaç
2024-03-14  7:04                                     ` Abdullah Ömer Yamaç
2024-04-04 10:11                                       ` Abdullah Ömer Yamaç
2024-04-05  2:11                                         ` Honnappa Nagarahalli
2024-04-15 11:26                                         ` [PATCH v4] " Abdullah Ömer Yamaç
2024-04-23 13:49                                           ` Abdullah Ömer Yamaç
2024-04-23 21:24                                           ` Stephen Hemminger
2024-04-25 14:03                                             ` Abdullah Ömer Yamaç
2024-04-27 19:54                                               ` [PATCH v5] " Abdullah Ömer Yamaç
2024-05-10  3:05                                                 ` Abdullah Ömer Yamaç
2024-05-13  5:24                                                 ` Honnappa Nagarahalli
2024-05-13 15:34                                                   ` Abdullah Ömer Yamaç
2024-05-15 10:49                                                     ` Abdullah Ömer Yamaç
2024-05-15 10:54                                                     ` [PATCH v6] " Abdullah Ömer Yamaç
2024-05-20 18:50                                                       ` Honnappa Nagarahalli
2024-06-18 14:09                                                         ` David Marchand

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=68684A5E-2746-4789-AA6C-7FF09FDC785B@arm.com \
    --to=honnappa.nagarahalli@arm.com \
    --cc=aomeryamac@gmail.com \
    --cc=dev@dpdk.org \
    --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).