mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org,
	linux-fsdevel@vger.kernel.org, fmdefrancesco@gmail.com
Subject: Re: [PATCH 1/2] fs/aio: Use kmap_local() instead of kmap()
Date: Wed, 18 Jan 2023 13:19:13 -0500	[thread overview]
Message-ID: <x49mt6f7ljy.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20230118152603.28301-1-kent.overstreet@linux.dev> (Kent Overstreet's message of "Wed, 18 Jan 2023 10:26:02 -0500")

Hi, Kent,

Kent Overstreet <kent.overstreet@linux.dev> writes:

> Originally, we used kmap() instead of kmap_atomic() for reading events
> out of the completion ringbuffer because we're using copy_to_user(),
> which can fault.
>
> Now that kmap_local() is a thing, use that instead.

This has already been proposed as part of a more comprehensive patch:
  https://lore.kernel.org/linux-fsdevel/20230109175629.9482-1-fmdefrancesco@gmail.com/

Would you be willing to review that one?

Thanks!
Jeff

>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> Cc: Benjamin LaHaise <bcrl@kvack.org
> Cc: linux-aio@kvack.org
> Cc: linux-fsdevel@vger.kernel.org
> ---
>  fs/aio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 5b2ff20ad3..3f795ed2a2 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1246,10 +1246,10 @@ static long aio_read_events_ring(struct kioctx *ctx,
>  		avail = min(avail, nr - ret);
>  		avail = min_t(long, avail, AIO_EVENTS_PER_PAGE - pos);
>  
> -		ev = kmap(page);
> +		ev = kmap_local_page(page);
>  		copy_ret = copy_to_user(event + ret, ev + pos,
>  					sizeof(*ev) * avail);
> -		kunmap(page);
> +		kunmap_local(ev);
>  
>  		if (unlikely(copy_ret)) {
>  			ret = -EFAULT;


  parent reply	other threads:[~2023-01-18 18:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 15:26 Kent Overstreet
2023-01-18 15:26 ` [PATCH 2/2] fs/aio: obey min_nr when doing wakeups Kent Overstreet
2023-01-18 18:19 ` Jeff Moyer [this message]
2023-01-20 14:03 ` [PATCH v2] " Kent Overstreet
2023-01-20 19:47   ` Jeff Moyer
2023-01-23 16:17     ` Jeff Moyer
2023-01-23 19:54       ` Kent Overstreet

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=x49mt6f7ljy.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --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

all inboxes | Powered by JetHome®