linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>
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 09:13:40 -0500	[thread overview]
Message-ID: <x498ri9ma5n.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <Y73+xKXDELSd14p1@ZenIV> (Al Viro's message of "Wed, 11 Jan 2023 00:11:48 +0000")

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.

>>  
>>  	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.

Cheers,
Jeff


  reply	other threads:[~2023-01-11 14:11 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 [this message]
2023-01-11 16:02     ` Al Viro
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=x498ri9ma5n.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=bcrl@kvack.org \
    --cc=fmdefrancesco@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).