]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: vmalloc: convert vread() to vread_iter()
authorLorenzo Stoakes <lstoakes@gmail.com>
Wed, 22 Mar 2023 18:57:04 +0000 (18:57 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 23:25:14 +0000 (16:25 -0700)
commitdb263d11bfd93e5d74d27d4717b24ce56b986c93
treefae9b0a9b01c88140a6de46c594668efa924b040
parent636e054a04760854a6971e5ee9b21e5b4052ba42
mm: vmalloc: convert vread() to vread_iter()

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.  We continue faulting in until
the operation is complete.

Additionally, we must account for the fact that at any point a copy may
fail (most likely due to a fault not being able to occur), we exit
indicating fewer bytes retrieved than expected.

Link: https://lkml.kernel.org/r/941f88bc5ab928e6656e1e2593b91bf0f8c81e1b.1679511146.git.lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Baoquan He <bhe@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Liu Shixin <liushixin2@huawei.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/kcore.c
include/linux/vmalloc.h
mm/nommu.c
mm/vmalloc.c