public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: dhowells@redhat.com, Matthew Wilcox <willy@infradead.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>, Jeff Layton <jlayton@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Chuck Lever III <chuck.lever@oracle.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH v3 41/55] iscsi: Assume "sendpage" is okay in iscsi_tcp_segment_map()
Date: Tue, 25 Apr 2023 09:30:30 +0100	[thread overview]
Message-ID: <494037.1682411430@warthog.procyon.org.uk> (raw)
In-Reply-To: <1957131.PYKUYFuaPT@suse>

Fabio M. De Francesco <fmdefrancesco@gmail.com> wrote:

> > -	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()? 

Actually, it might be worth dropping segment->sg_mapped and segment->data and
only doing the kmap_local when necessary.

And this:

			struct msghdr msg = { .msg_flags = flags };
			struct kvec iov = {
				.iov_base = segment->data + offset,
				.iov_len = copy
			};

			r = kernel_sendmsg(sk, &msg, &iov, 1, copy);

should really be using struct bvec, not struct kvec - then the mapping isn't
necessary.  It looks like this might be the only place the mapping is used,
but I'm not 100% certain.

David


  reply	other threads:[~2023-04-25  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230331160914.1608208-1-dhowells@redhat.com>
2023-03-31 16:08 ` [PATCH v3 40/55] iscsi: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage David Howells
2023-03-31 16:09 ` [PATCH v3 41/55] iscsi: Assume "sendpage" is okay in iscsi_tcp_segment_map() David Howells
2023-04-24 17:19   ` Fabio M. De Francesco
2023-04-25  8:30     ` David Howells [this message]
2023-04-25 13:13       ` Fabio M. De Francesco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=494037.1682411430@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=hch@infradead.org \
    --cc=jlayton@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=target-devel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox