[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB7PR04MB42522D573B28FD11CCD2F22C8B910@DB7PR04MB4252.eurprd04.prod.outlook.com>
Date: Thu, 31 Jan 2019 06:25:26 +0000
From: Vakul Garg <vakul.garg@....com>
To: David Miller <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"borisp@...lanox.com" <borisp@...lanox.com>,
"aviadye@...lanox.com" <aviadye@...lanox.com>,
"davejwatson@...com" <davejwatson@...com>,
"doronrk@...com" <doronrk@...com>
Subject: RE: [PATCH net-next] strparser: Return if socket does not have
required number of bytes
> -----Original Message-----
> From: David Miller <davem@...emloft.net>
> Sent: Thursday, January 31, 2019 11:30 AM
> To: Vakul Garg <vakul.garg@....com>
> Cc: netdev@...r.kernel.org; borisp@...lanox.com;
> aviadye@...lanox.com; davejwatson@...com; doronrk@...com
> Subject: Re: [PATCH net-next] strparser: Return if socket does not have
> required number of bytes
>
> From: Vakul Garg <vakul.garg@....com>
> Date: Wed, 30 Jan 2019 07:31:44 +0000
>
> > Function strp_data_ready() should peek the associated socket to check
> > whether it has the required number of bytes available before queueing
> > work or initiating socket read via strp_read_sock(). This saves cpu
> > cycles because strp_read_sock() is called only when required amount of
> > data is available.
> >
> > Signed-off-by: Vakul Garg <vakul.garg@....com>
>
> You can't do this, I think. It's racy and the user socket owned check is
> absolutely necessary before you do the need bytes check.
Do you mean to say that 'peek_len' operation can't be invoked if the socket is already owned by some other context?
My understanding by reading following link is that we can to peek_len operation without acquiring sock lock.
https://elixir.bootlin.com/linux/v5.0-rc4/source/include/linux/net.h#L191
Can you please kindly elaborate the problem?
Powered by blists - more mailing lists