Hi Huawei, On 02/26/2016 10:07 AM, Xie, Huawei wrote: > On 2/26/2016 4:56 PM, Olivier MATZ wrote: >> test_one_pktmbuf(struct rte_mbuf *m) >> { >> /* same as before without the allocation/free */ >> } >> >> test_pkt_mbuf(void) >> { >> m = rte_pktmbuf_alloc(pool); >> test_one_pktmbuf(m); >> rte_pktmbuf_free(m); >> >> ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT) >> for (i = 0; i < BULK_CNT; i++) { >> m = mtab[i]; >> test_one_pktmbuf(m); >> rte_pktmbuf_free(m); >> } >> } > > This is to test the functionality. > Let us also have the case like the following? > cycles_start = rte_get_timer_cycles(); > while(rounds--) { > > ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT) > for (i = 0; i < BULK_CNT; i++) { > m = mtab[i]; > /* some work if needed */ > rte_pktmbuf_free(m); > } > } > cycles_end = rte_get_timer_cycles(); > > to compare with > cycles_start = rte_get_timer_cycles(); > while(rounds--) { > for (i = 0; i < BULK_CNT; i++) > mtab[i] = rte_pktmbuf_alloc(...); > > ret = rte_pktmbuf_alloc_bulk(pool, mtab, BULK_CNT) > for (i = 0; i < BULK_CNT; i++) { > m = mtab[i]; > /* some work if needed */ > rte_pktmbuf_free(m); > } > } > cycles_end = rte_get_timer_cycles();
In my opinion, it's already quite obvious that the bulk allocation will be faster than the non-bulk (and we already have some mempool benchmarks showing it). So I would say that functional testing is enough. On the other hand, it would be good to see if some examples applications could be updated to take advantage of the new API (as you did for the librte_vhost). What do you think?