lkml.org 
[lkml]   [2023]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] fs/aio: Replace kmap{,_atomic}() with kmap_local_page()
Date
Al Viro <viro@zeniv.linux.org.uk> writes:

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

Thanks for spelling it out. I guess it's a matter of opinion, but I
don't find that more readable.

Cheers,
Jeff

\
 
 \ /
  Last update: 2023-03-26 23:35    [W:0.067 / U:1.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site