From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [dpdk-stable] [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling Date: Wed, 11 Jan 2017 15:51:22 +0100 Message-ID: <1610499.AMUobBPor6@xps13> References: <1484108832-19907-1-git-send-email-yuanhan.liu@linux.intel.com> <1484108832-19907-2-git-send-email-yuanhan.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Tan Jianfeng , Wang Zhihong , Olivier Matz , Maxime Coquelin , "Michael S. Tsirkin" To: Yuanhan Liu , Jianbo Liu , Jerin Jacob , Jan Viktorin , Chao Zhu Return-path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 618F2F614 for ; Wed, 11 Jan 2017 15:51:18 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id f73so27312974wmf.1 for ; Wed, 11 Jan 2017 06:51:18 -0800 (PST) In-Reply-To: <1484108832-19907-2-git-send-email-yuanhan.liu@linux.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-01-11 12:27, Yuanhan Liu: > The fact that virtio net header is initiated to zero in PMD driver > init stage means that these costly writes are unnecessary and could > be avoided: > > if (hdr->csum_start != 0) > hdr->csum_start = 0; > > And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the > performance drop introduced by TSO enabling is recovered: it could > be up to 20% in micro benchmarking. This patch is adding a condition to assignments. We need a benchmark on other architectures like ARM. Please anyone? [...] > +/* avoid write operation when necessary, to lessen cache issues */ > +#define ASSIGN_UNLESS_EQUAL(var, val) do { \ > + if ((var) != (val)) \ > + (var) = (val); \ > +} while (0)