DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Lilijun (Jerry)" <jerry.lilijun@huawei.com>
To: "'dev@dpdk.org'" <dev@dpdk.org>, "'stable@dpdk.org'" <stable@dpdk.org>
Subject: [dpdk-dev] rte_hash bug: can't iterate all entries when deleting keys in rte_hash iterate loop.
Date: Sat, 18 Apr 2020 10:00:09 +0000	[thread overview]
Message-ID: <40280F65B1B0B44E8089ED31C01616EBA496BC2A@dggeml529-mbx.china.huawei.com> (raw)

Hi all,

    In my test, entries can't be cleanup in rte_hash table when deleting keys in rte_hash iterate loop. The test steps:
    1.  create a hash table table1 with limit 30000, ext bucket enabled,  and insert 30000 entries into this hash table.
    2.  create a larger hash table table2 with limit 60000, , ext bucket enabled.
    3.  iterate all entries of table1 and insert them to the table2. Insert new 10000 entries to this table2.
    4.  Then flush all entries from table2 by deleting keys in rte_hash iterate loop. But there are still some keys leaked in table2.

    From my analysis, the keys idx are stored in rte_hash main bucket key slots and extend bucket key stots. 
    We iterate every no empty Keys in h->buckets and h->buckets_ext from start to last. 
    When deleting keys the function __rte_hash_compact_ll() may move last_bkt's key to previous bucket in order to compact extend bucket list.
    If the previous bucket has been iterated, the moved key may be missed for users. 
    Then those missed keys are leaked and rte_hash table can't be cleanup.

    Now I retry the iterate and delete keys, that can avoid this bug. 

    Is there any ideas or solutions on this bug?   Thanks.

Jerry.

                 reply	other threads:[~2020-04-18 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40280F65B1B0B44E8089ED31C01616EBA496BC2A@dggeml529-mbx.china.huawei.com \
    --to=jerry.lilijun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).