From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <konstantin.ananyev@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 8161F9AF6
 for <dev@dpdk.org>; Thu, 12 Feb 2015 14:08:47 +0100 (CET)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga103.fm.intel.com with ESMTP; 12 Feb 2015 05:01:37 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,565,1418112000"; d="scan'208";a="453672348"
Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75])
 by FMSMGA003.fm.intel.com with ESMTP; 12 Feb 2015 04:54:03 -0800
Received: from irsmsx105.ger.corp.intel.com ([169.254.7.81]) by
 IRSMSX153.ger.corp.intel.com ([169.254.9.2]) with mapi id 14.03.0195.001;
 Thu, 12 Feb 2015 13:08:44 +0000
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Liang, Cunming" <cunming.liang@intel.com>, Olivier MATZ
 <olivier.matz@6wind.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH v5 18/19] ring: add sched_yield to avoid spin forever
Thread-Index: AQHQRpxji6uzr387zUaYyTTxX0+np5zs3WAAgAAei4CAAABUMA==
Date: Thu, 12 Feb 2015 13:08:43 +0000
Message-ID: <2601191342CEEE43887BDE71AB977258213E5500@irsmsx105.ger.corp.intel.com>
References: <1422842559-13617-1-git-send-email-cunming.liang@intel.com>
 <1423728996-3004-1-git-send-email-cunming.liang@intel.com>
 <1423728996-3004-19-git-send-email-cunming.liang@intel.com>
 <54DC8B78.2040009@6wind.com>
 <D0158A423229094DA7ABF71CF2FA0DA3118D95B1@shsmsx102.ccr.corp.intel.com>
In-Reply-To: <D0158A423229094DA7ABF71CF2FA0DA3118D95B1@shsmsx102.ccr.corp.intel.com>
Accept-Language: en-IE, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [163.33.239.180]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v5 18/19] ring: add sched_yield to avoid spin
	forever
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Feb 2015 13:08:48 -0000



> -----Original Message-----
> From: Liang, Cunming
> Sent: Thursday, February 12, 2015 1:05 PM
> To: Olivier MATZ; dev@dpdk.org
> Cc: Ananyev, Konstantin
> Subject: RE: [PATCH v5 18/19] ring: add sched_yield to avoid spin forever
>=20
> Hi,
>=20
> > -----Original Message-----
> > From: Olivier MATZ [mailto:olivier.matz@6wind.com]
> > Sent: Thursday, February 12, 2015 7:16 PM
> > To: Liang, Cunming; dev@dpdk.org
> > Cc: Ananyev, Konstantin
> > Subject: Re: [PATCH v5 18/19] ring: add sched_yield to avoid spin forev=
er
> >
> > Hi,
> >
> > On 02/12/2015 09:16 AM, Cunming Liang wrote:
> > > Add a sched_yield() syscall if the thread spins for too long, waiting=
 other thread
> > to finish its operations on the ring.
> > > That gives pre-empted thread a chance to proceed and finish with ring
> > enqnue/dequeue operation.
> > > The purpose is to reduce contention on the ring. By ring_perf_test, i=
t doesn't
> > shows additional perf penalty.
> > >
> > > Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> > > ---
> > >   v5 changes:
> > >     add RTE_RING_PAUSE_REP to config file
> > >
> > >   v4 changes:
> > >     update and add more comments on sched_yield()
> > >
> > >   v3 changes:
> > >     new patch adding sched_yield() in rte_ring to avoid long spin
> > >
> > >   config/common_bsdapp       |  1 +
> > >   config/common_linuxapp     |  1 +
> > >   lib/librte_ring/rte_ring.h | 31 +++++++++++++++++++++++++++----
> > >   3 files changed, 29 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/config/common_bsdapp b/config/common_bsdapp
> > > index 57bacb8..52c5143 100644
> > > --- a/config/common_bsdapp
> > > +++ b/config/common_bsdapp
> > > @@ -234,6 +234,7 @@ CONFIG_RTE_PMD_PACKET_PREFETCH=3Dy
> > >   CONFIG_RTE_LIBRTE_RING=3Dy
> > >   CONFIG_RTE_LIBRTE_RING_DEBUG=3Dn
> > >   CONFIG_RTE_RING_SPLIT_PROD_CONS=3Dn
> > > +CONFIG_RTE_RING_PAUSE_REP=3Dn
> >
> > Maybe it's better to use CONFIG_RTE_RING_PAUSE_REP=3D0 instead?
> > If I understand well, it has to be set to an integer value to
> > enable it, am I correct?
> [LCM] If RTE_RING_PAUSE_REP=3DN (no define), by default will use 0. If it=
's set to 'y'(=3D1), will issue yield in the most frequent rate.
> It also can set as integer to assign any number. All cases works for this=
 configure.
> One point is in configure file, just demonstrate the default way to use i=
t.
> It can't prevent to use anything unexpected. Except we rule the n & y ill=
egal for this option.
> The meaningful value of it can write in the doc.

I also think that it is better avoid 'y' and 'n' (though as you said it wou=
ld work), but use integers for all cases.
Less confusion for the users.
Konstantin=20

> >
> > Thanks,
> > Olivier