From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by dpdk.org (Postfix) with ESMTP id 7ECA05681 for ; Fri, 27 Feb 2015 01:49:40 +0100 (CET) Received: by iecrd18 with SMTP id rd18so23608923iec.5 for ; Thu, 26 Feb 2015 16:49:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=IknRzYbfduSuuVhhe8k48u4Nds5FQxes8UH+NY2aoXI=; b=TIiSV0R4znYjCb7iipuc3vJtRd27tUBG5J7RQtPXyrgJn6PY1jiU3gYFax0Wbuexkm HeyVPFznbzZ6JNLN0xtfQbKzN4BvRLoKd0rNI805ncBY1cauXBQ3RgqlNfyPSOjdAlOm ypGz6JmqH1RsCcXMT48eAA5Z42J4mYQ1dr4fwsbMqmZzlBJW4fed2QIPlS7dm1jjbjZR Xx+5Lo+O+EWsujvydxiHehSApqtpSPcMt3ubGI8hyouYZW0JsNHjG2snWL45um4xUlzC 9RR6hIUWIL5+4vbNA533hgMSyg9z2ZlRo7K+UfsD7sVaB9HmOypp24gf6Rw8Ilxmm/4i gwTg== X-Gm-Message-State: ALoCoQnhkBQD7aobySSL8a2ons2WatlMR8FtSb4nLmXTrcsvUUi9lzoVR8CzF2iGWo681At8JwLi X-Received: by 10.50.25.231 with SMTP id f7mr992534igg.48.1424998180034; Thu, 26 Feb 2015 16:49:40 -0800 (PST) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id w9sm314883igl.0.2015.02.26.16.49.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Feb 2015 16:49:39 -0800 (PST) Date: Thu, 26 Feb 2015 16:49:41 -0800 From: Stephen Hemminger To: "vadim.suraev@gmail.com" Message-ID: <20150226164941.68d9371a@urahara> In-Reply-To: <1424992506-20484-1-git-send-email-vadim.suraev@gmail.com> References: <1424992506-20484-1-git-send-email-vadim.suraev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] rte_mbuf: scattered pktmbufs freeing optimization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2015 00:49:40 -0000 On Fri, 27 Feb 2015 01:15:06 +0200 "vadim.suraev@gmail.com" wrote: > +static inline void __attribute__((always_inline)) > +rte_pktmbuf_free_bulk(struct rte_mbuf *head) Quit with the inlining. Inlining all the time isn't faster it just increase the code bloat and causes i-cache misses. > +{ > + void *mbufs[MAX_MBUF_FREE_SIZE]; > + unsigned mbufs_count = 0; > + struct rte_mbuf *next; > + > + RTE_MBUF_MEMPOOL_CHECK1(head); > + > + while(head) { > + next = head->next; > + head->next = NULL; > + if(__rte_pktmbuf_prefree_seg(head)) { Missing space after 'if' > + RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(head) == 0); > + RTE_MBUF_MEMPOOL_CHECK2(head); > + mbufs[mbufs_count++] = head; > + } > + head = next; > + if(mbufs_count == MAX_MBUF_FREE_SIZE) { > + rte_mempool_put_bulk(((struct rte_mbuf *)mbufs[0])->pool,mbufs,mbufs_count); why not have mbufs[] be type struct rte_mbuf * and avoid casting. Casting is one of the sources of bugs in C code. > + mbufs_count = 0; > + } > + } > + if(mbufs_count > 0) { Don't need {} on one line if clause > + rte_mempool_put_bulk(((struct rte_mbuf *)mbufs[0])->pool,mbufs,mbufs_count); > + } > +}