linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <bhe@redhat.com>, Uladzislau Rezki <urezki@gmail.com>,
	Matthew Wilcox <willy@infradead.org>,
	Liu Shixin <liushixin2@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	Jens Axboe <axboe@kernel.dk>,
	Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v6 4/4] mm: vmalloc: convert vread() to vread_iter()
Date: Wed, 22 Mar 2023 18:02:34 +0100	[thread overview]
Message-ID: <3e2d1f69-5cd8-8824-0a2e-a1c2c9029f66@redhat.com> (raw)
In-Reply-To: <4f1b394f96a4d1368d9a5c3784ebee631fb8d101.1679496827.git.lstoakes@gmail.com>

On 22.03.23 15:55, Lorenzo Stoakes wrote:
> Having previously laid the foundation for converting vread() to an iterator
> function, pull the trigger and do so.
> 
> This patch attempts to provide minimal refactoring and to reflect the
> existing logic as best we can, for example we continue to zero portions of
> memory not read, as before.
> 
> Overall, there should be no functional difference other than a performance
> improvement in /proc/kcore access to vmalloc regions.
> 
> Now we have eliminated the need for a bounce buffer in read_kcore_iter(),
> we dispense with it, and try to write to user memory optimistically but
> with faults disabled via copy_page_to_iter_nofault(). We already have
> preemption disabled by holding a spin lock.
> 
> If this fails, we fault in and retry a single time. This is a conservative
> approach intended to avoid spinning on vread_iter() if we repeatedly
> encouter issues reading from it.

I have to ask again: Can you comment why that is ok? You might end up 
signaling -EFAULT to user space simply because swapping/page 
migration/whatever triggered at the wrong time.

That could break existing user space or which important part am I missing?

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2023-03-22 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 14:55 [PATCH v6 0/4] convert read_kcore(), vread() to use iterators Lorenzo Stoakes
2023-03-22 14:55 ` [PATCH v6 1/4] fs/proc/kcore: avoid bounce buffer for ktext data Lorenzo Stoakes
2023-03-22 14:55 ` [PATCH v6 2/4] fs/proc/kcore: convert read_kcore() to read_kcore_iter() Lorenzo Stoakes
2023-03-22 14:55 ` [PATCH v6 3/4] iov_iter: add copy_page_to_iter_nofault() Lorenzo Stoakes
2023-03-22 14:55 ` [PATCH v6 4/4] mm: vmalloc: convert vread() to vread_iter() Lorenzo Stoakes
2023-03-22 17:02   ` David Hildenbrand [this message]
2023-03-22 18:36     ` Lorenzo Stoakes

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=3e2d1f69-5cd8-8824-0a2e-a1c2c9029f66@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bhe@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=lstoakes@gmail.com \
    --cc=urezki@gmail.com \
    --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