DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Fengnan Chang <changfengnan@bytedance.com>
Cc: anatoly.burakov@intel.com, dev@dpdk.org, dkozlyuk@nvidia.com
Subject: Re: [RFC PATCH] move memset out of hold lock when rte_free
Date: Wed, 6 Sep 2023 08:08:19 -0700	[thread overview]
Message-ID: <20230906080819.689bcb8d@hermes.local> (raw)
In-Reply-To: <20230831111937.60975-1-changfengnan@bytedance.com>

On Thu, 31 Aug 2023 19:19:37 +0800
Fengnan Chang <changfengnan@bytedance.com> wrote:

> +#ifndef RTE_MALLOC_DEBUG
> +	if (internal_conf->legacy_mem) {
> +		/* If orig_elem is dirty, the joint element is clean, we need do memset now */
> +		if (elem->orig_elem->dirty && !elem->dirty)
> +			memset(ptr, 0, data_len);
> +	} else if (!elem->dirty) {
> +		memset(ptr, 0, data_len);
> +	}
> +#else
> +	/* Always poison the memory in debug mode. */
> +	memset(ptr, MALLOC_POISON, data_len);
> +#endif

The code reads better if positive clause was first.
I.e.

#ifdef RTE_MALLOC_DEBUG
	/* Always poison the memory in debug mode. */
	memset(ptr, MALLOC_POISON, data_len);
#else
...

  reply	other threads:[~2023-09-06 15:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 11:19 Fengnan Chang
2023-09-06 15:08 ` Stephen Hemminger [this message]
2023-09-12  2:44   ` [External] " Fengnan Chang
2023-09-12  9:13     ` Fengnan Chang

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=20230906080819.689bcb8d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=changfengnan@bytedance.com \
    --cc=dev@dpdk.org \
    --cc=dkozlyuk@nvidia.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).