RE: [PATCH] hv: use substraction to update ring buffer index

2017-01-20 Thread Long Li
> -Original Message- > From: Dexuan Cui > Sent: Sunday, January 15, 2017 7:12 PM > To: Long Li ; KY Srinivasan ; > Haiyang Zhang > Cc: de...@linuxdriverproject.org; linux-kernel@vger.kernel.org > Subject: RE: [PATCH] hv: use substraction to update ring buffer ind

RE: [PATCH] hv: use substraction to update ring buffer index

2017-01-15 Thread Dexuan Cui
> From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of Long Li > Sent: Thursday, January 5, 2017 12:08 > To: KY Srinivasan ; Haiyang Zhang > > Cc: de...@linuxdriverproject.org; linux-kernel@vger.kernel.org > Subject: [PATCH] hv: use substraction

RE: [PATCH] hv: use substraction to update ring buffer index

2017-01-06 Thread Long Li
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Thursday, January 05, 2017 3:40 AM > To: Long Li > Cc: KY Srinivasan ; Haiyang Zhang > ; de...@linuxdriverproject.org; linux- > ker...@vger.kernel.org > Subject: Re: [PATCH]

Re: [PATCH] hv: use substraction to update ring buffer index

2017-01-05 Thread Dan Carpenter
On Thu, Jan 05, 2017 at 02:39:55PM +0300, Dan Carpenter wrote: > > @@ -179,7 +180,8 @@ static u32 hv_copyfrom_ringbuffer( > > memcpy(dest, ring_buffer + start_read_offset, destlen); > > > > start_read_offset += destlen; > > - start_read_offset %= ring_buffer_size; > > + if (start_read

Re: [PATCH] hv: use substraction to update ring buffer index

2017-01-05 Thread Dan Carpenter
On Wed, Jan 04, 2017 at 08:08:22PM -0800, Long Li wrote: > From: Long Li > > The ring buffer code uses %= to calculate index. For x86/64, %= compiles to > div, more than 10 times slower than sub. > > Replace div with sub for this data heavy code path. > > Signed-off-by: Long Li > --- > driver

[PATCH] hv: use substraction to update ring buffer index

2017-01-04 Thread Long Li
From: Long Li The ring buffer code uses %= to calculate index. For x86/64, %= compiles to div, more than 10 times slower than sub. Replace div with sub for this data heavy code path. Signed-off-by: Long Li --- drivers/hv/ring_buffer.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletion