Message ID | 20220124111439.2911-1-wanjunjie@bytedance.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev] netdev-dpdk: add mempool count in cmd get-mempool-info | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
Wan Junjie <wanjunjie@bytedance.com> writes: > The ```rte_mempool_avail_count``` and ```rte_mempool_in_use_count``` > can tell us the usage of the mempool. It could be helpful for debug > on any memleak in the mempool. > Add a line in the cmd's output. > - Count: avail (118988), in use (12084) > > Signed-off-by: Wan Junjie <wanjunjie@bytedance.com> > --- This is a good idea. Thanks. Acked-by: Aaron Conole <aconole@redhat.com>
On 24/01/2022 11:14, Wan Junjie wrote: > The ```rte_mempool_avail_count``` and ```rte_mempool_in_use_count``` > can tell us the usage of the mempool. It could be helpful for debug > on any memleak in the mempool. > Add a line in the cmd's output. > - Count: avail (118988), in use (12084) > > Signed-off-by: Wan Junjie <wanjunjie@bytedance.com> > --- > lib/netdev-dpdk.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index b6b29c75e..e5d40a816 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -3864,6 +3864,9 @@ netdev_dpdk_get_mempool_info(struct unixctl_conn *conn, > ovs_mutex_lock(&dpdk_mp_mutex); > > rte_mempool_dump(stream, dev->dpdk_mp->mp); > + fprintf(stream, " - Count: avail (%u), in use (%u)\n", > + rte_mempool_avail_count(dev->dpdk_mp->mp), > + rte_mempool_in_use_count(dev->dpdk_mp->mp)); Hi, output is below, # ovs-appctl netdev-dpdk/get-mempool-info myport mempool <ovs530eb21900021580262144>@0x17f16fbc0 flags=10 socket_id=0 pool=0x17ed6f900 iova=0x17f16fbc0 nb_mem_chunks=1 size=262144 populated_size=262144 header_size=64 elt_size=2880 trailer_size=64 total_obj_size=3008 private_data_size=64 ops_index=7 ops_name: <ring_mp_mc> avg bytes/object=3008.837646 internal cache infos: cache_size=512 cache_count[0]=0 cache_count[1]=12 cache_count[2]=0 ... cache_count[127]=0 total_cache_count=12 common_pool_count=260096 no statistics available - Count: avail (260108), in use (2036) Just to note that this information can already be calculated from the current output, e.g. avail = total_cache_count + common_pool_count in use = size - avail It is holding the locks for a little longer, but removes the need to understand the raw DPDK output and use a calculator, so overall seems like an improvement. nit: the " - " prefix looks out of place. > > ovs_mutex_unlock(&dpdk_mp_mutex); > ovs_mutex_unlock(&dev->mutex); >
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b6b29c75e..e5d40a816 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3864,6 +3864,9 @@ netdev_dpdk_get_mempool_info(struct unixctl_conn *conn, ovs_mutex_lock(&dpdk_mp_mutex); rte_mempool_dump(stream, dev->dpdk_mp->mp); + fprintf(stream, " - Count: avail (%u), in use (%u)\n", + rte_mempool_avail_count(dev->dpdk_mp->mp), + rte_mempool_in_use_count(dev->dpdk_mp->mp)); ovs_mutex_unlock(&dpdk_mp_mutex); ovs_mutex_unlock(&dev->mutex);
The ```rte_mempool_avail_count``` and ```rte_mempool_in_use_count``` can tell us the usage of the mempool. It could be helpful for debug on any memleak in the mempool. Add a line in the cmd's output. - Count: avail (118988), in use (12084) Signed-off-by: Wan Junjie <wanjunjie@bytedance.com> --- lib/netdev-dpdk.c | 3 +++ 1 file changed, 3 insertions(+)