Re: [PATCH v3 41/55] iscsi: Assume "sendpage" is okay in iscsi_tcp_segment_map()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On venerdì 31 marzo 2023 18:09:00 CEST David Howells wrote:
> As iscsi is now using sendmsg() with MSG_SPLICE_PAGES rather than sendpage,
> assume that sendpage_ok() will return true in iscsi_tcp_segment_map() and
> leave it to TCP to copy the data if not.
> 
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
> cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> cc: Eric Dumazet <edumazet@xxxxxxxxxx>
> cc: Jakub Kicinski <kuba@xxxxxxxxxx>
> cc: Paolo Abeni <pabeni@xxxxxxxxxx>
> cc: Jens Axboe <axboe@xxxxxxxxx>
> cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> cc: linux-scsi@xxxxxxxxxxxxxxx
> cc: target-devel@xxxxxxxxxxxxxxx
> cc: netdev@xxxxxxxxxxxxxxx
> ---
>  drivers/scsi/libiscsi_tcp.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
> index c182aa83f2c9..07ba0d864820 100644
> --- a/drivers/scsi/libiscsi_tcp.c
> +++ b/drivers/scsi/libiscsi_tcp.c
> @@ -128,18 +128,11 @@ static void iscsi_tcp_segment_map(struct iscsi_segment
> *segment, int recv) * coalescing neighboring slab objects into a single frag
> which
>  	 * triggers one of hardened usercopy checks.
>  	 */
> -	if (!recv && sendpage_ok(sg_page(sg)))
> +	if (!recv)
>  		return;
> 
> -	if (recv) {
> -		segment->atomic_mapped = true;
> -		segment->sg_mapped = kmap_atomic(sg_page(sg));
> -	} else {
> -		segment->atomic_mapped = false;
> -		/* the xmit path can sleep with the page mapped so use 
kmap */
> -		segment->sg_mapped = kmap(sg_page(sg));
> -	}
> -
> +	segment->atomic_mapped = true;
> +	segment->sg_mapped = kmap_atomic(sg_page(sg));

As you probably know, kmap_atomic() is deprecated.

I must admit that I'm not an expert of this code, however, it looks like the 
mapping has no need to rely on the side effects of kmap_atomic() (i.e., 
pagefault_disable() and preempt_disable() - but I'm not entirely sure about 
the possibility that preemption should be explicitly disabled along with the 
replacement with kmap_local_page()). 

Last year I've been working on several conversions from kmap{,_atomic}() to 
kmap_local_page(), however I'm still not sure to understand what's happening 
here...

Am I missing any important details? Can you please explain why we still need 
that kmap_atomic() instead of kmap_local_page()? 

Thanks in advance,

Fabio

>  	segment->data = segment->sg_mapped + sg->offset + segment-
>sg_offset;
>  }








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux