<html>
    <head>
      <base href="https://bugs.dpdk.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - KNI : memory-leaks, each time kni_rx_burst it is allocates new mbufs even if no needs."
   href="https://bugs.dpdk.org/show_bug.cgi?id=1227">1227</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>KNI : memory-leaks, each time kni_rx_burst it is allocates new mbufs even if no needs.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DPDK
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>22.11
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ethdev
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dev@dpdk.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yasinncaner@gmail.com
          </td>
        </tr>

        <tr>
          <th>Target Milestone</th>
          <td>---
          </td>
        </tr></table>
      <p>
        <div class="bz_comment_block">
          <pre class="bz_comment_text">Created <span class=""><a href="attachment.cgi?id=251" name="attach_251" title="flow_kni_rx_burst">attachment 251</a> <a href="attachment.cgi?id=251&action=edit" title="flow_kni_rx_burst">[details]</a></span>
flow_kni_rx_burst

Hello

I tried to explain memory-leak via graph 

<a href="https://pastebin.ubuntu.com/p/s4h5psqtgZ/">https://pastebin.ubuntu.com/p/s4h5psqtgZ/</a>


scenario : 

1. kni_alloc allocates 32 units (kni->alloc_q) then completes initialization
2. rte_kni_rx_burst receive 1 packet from kernel. 1 of 31 units is filled by
message, 31 units is empty but it is allocated in kni->alloc_q.
3. rte_kni_rx_burst then allocates another 32 units i dont know why but there
is a comment like this."If buffers removed, allocate mbufs and then put them
into alloc_q" ( How to tests buffers are removed or not? there is not any query
in code)
4. 1 message mbuf is transmited via rte_eth_tx_burst . 
5. 1 message mbuf never back to freed and back to original memory pool. 31+32
units memory act like in use but they are not. never back to original memory
pool
6. this cycle goes on to 2 .

? Why there is newer allocation in rte_kni_rx_burst i dont know.
? I tried to free 1 packet via rte_pktmbuf_free but sometimes corrupt to pool
like below. sometimes 1 packet/unit back to original memory pool
[UseCount_mpool:65][avail_mpool:10334]
[UseCount_mpool:4294967135][avail_mpool:10560]
? In my view, after transmiting message to mbufs should be in to kni->free_q.
? in my view, there is missing query in func kni_allocate_mbufs to test alloc_q
is empty or not.
Best regards.
          </pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
      <div itemscope itemtype="http://schema.org/EmailMessage">
        <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
          
          <link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1227">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>