All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Thomas Haller <thaller@redhat.com>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nft] mergesort: avoid cloning value in expr_msort_cmp()
Date: Wed, 27 Sep 2023 10:46:13 +0200	[thread overview]
Message-ID: <ZRPr1QVa268brGbA@calendula> (raw)
In-Reply-To: <20230927065941.1386475-1-thaller@redhat.com>

Hi Thomas,

Thanks for your patch.

On Wed, Sep 27, 2023 at 08:59:34AM +0200, Thomas Haller wrote:
> If we have a plain EXPR_VALUE value, there is no need to copy
> it via mpz_set().
> 
> Signed-off-by: Thomas Haller <thaller@redhat.com>
> ---
>  src/mergesort.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/src/mergesort.c b/src/mergesort.c
> index 5965236af6b7..af7f163b2779 100644
> --- a/src/mergesort.c
> +++ b/src/mergesort.c
> @@ -12,8 +12,6 @@
>  #include <gmputil.h>
>  #include <list.h>
>  
> -static void expr_msort_value(const struct expr *expr, mpz_t value);
> -
>  static void concat_expr_msort_value(const struct expr *expr, mpz_t value)
>  {
>  	unsigned int len = 0, ilen;
> @@ -29,20 +27,20 @@ static void concat_expr_msort_value(const struct expr *expr, mpz_t value)
>  	mpz_import_data(value, data, BYTEORDER_HOST_ENDIAN, len);
>  }
>  
> -static void expr_msort_value(const struct expr *expr, mpz_t value)
> +static mpz_srcptr expr_msort_value(const struct expr *expr, mpz_t value)
>  {
> +recursive_again:

We are in userspace, recursion is possible. Any chance to avoid the
copy without this goto approach?

  reply	other threads:[~2023-09-27  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27  6:59 [PATCH nft] mergesort: avoid cloning value in expr_msort_cmp() Thomas Haller
2023-09-27  8:46 ` Pablo Neira Ayuso [this message]
2023-09-27  9:05   ` Thomas Haller

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=ZRPr1QVa268brGbA@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thaller@redhat.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.