linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Benjamin LaHaise <bcrl@kvack.org>,
	linux-aio@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Venkataramanan,
	Anirudh" <anirudh.venkataramanan@intel.com>,
	Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH v2] fs/aio: Replace kmap{,_atomic}() with kmap_local_page()
Date: Wed, 11 Jan 2023 16:02:26 +0000	[thread overview]
Message-ID: <Y77dkghufF6GVq1Y@ZenIV> (raw)
In-Reply-To: <x498ri9ma5n.fsf@segfault.boston.devel.redhat.com>

On Wed, Jan 11, 2023 at 09:13:40AM -0500, Jeff Moyer wrote:
> Hi, Al,
> 
> Al Viro <viro@zeniv.linux.org.uk> writes:
> 
> > On Mon, Jan 09, 2023 at 06:56:29PM +0100, Fabio M. De Francesco wrote:
> >
> >> -	ring = kmap_atomic(ctx->ring_pages[0]);
> >> +	ring = kmap_local_page(ctx->ring_pages[0]);
> >>  	ring->nr = nr_events;	/* user copy */
> >>  	ring->id = ~0U;
> >>  	ring->head = ring->tail = 0;
> >> @@ -575,7 +575,7 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
> >>  	ring->compat_features = AIO_RING_COMPAT_FEATURES;
> >>  	ring->incompat_features = AIO_RING_INCOMPAT_FEATURES;
> >>  	ring->header_length = sizeof(struct aio_ring);
> >> -	kunmap_atomic(ring);
> >> +	kunmap_local(ring);
> >>  	flush_dcache_page(ctx->ring_pages[0]);
> >
> > I wonder if it would be more readable as memcpy_to_page(), actually...
> 
> I'm not sure I understand what you're suggesting.

	memcpy_to_page(ctx->ring_pages[0], 0, &(struct aio_ring){
			.nr = nr_events, .id = ~0U, .magic = AIO_RING_MAGIC,
			.compat_features = AIO_RING_COMPAT_FEATURES,
			.in_compat_features = AIO_RING_INCOMPAT_FEATURES,
			.header_length = sizeof(struct aio_ring)},
			sizeof(struct aio_ring));

instead of the lines from kmap_atomic to flush_dcache_page...

> 
> >>  
> >>  	return 0;
> >> @@ -678,9 +678,9 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
> >>  					 * we are protected from page migration
> >>  					 * changes ring_pages by ->ring_lock.
> >>  					 */
> >> -					ring = kmap_atomic(ctx->ring_pages[0]);
> >> +					ring = kmap_local_page(ctx->ring_pages[0]);
> >>  					ring->id = ctx->id;
> >> -					kunmap_atomic(ring);
> >> +					kunmap_local(ring);
> >
> > Incidentally, does it need flush_dcache_page()?
> 
> Yes, good catch.

  reply	other threads:[~2023-01-11 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 17:56 [PATCH v2] fs/aio: Replace kmap{,_atomic}() with kmap_local_page() Fabio M. De Francesco
2023-01-11  0:11 ` Al Viro
2023-01-11 14:13   ` Jeff Moyer
2023-01-11 16:02     ` Al Viro [this message]
2023-01-11 16:20       ` Jeff Moyer
2023-01-11 16:29       ` Ira Weiny
2023-01-12 20:42       ` 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=Y77dkghufF6GVq1Y@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=bcrl@kvack.org \
    --cc=fmdefrancesco@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).