From: Lorenzo Stoakes <lstoakes@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
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:36:59 +0000 [thread overview]
Message-ID: <bad5dc54-f614-430a-a6a2-e96fea6ce1ec@lucifer.local> (raw)
In-Reply-To: <3e2d1f69-5cd8-8824-0a2e-a1c2c9029f66@redhat.com>
On Wed, Mar 22, 2023 at 06:02:34PM +0100, David Hildenbrand wrote:
> 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?
>
Actually you're right, this is not ok. I was being mistakenly overcautious
about spinning but in actual fact I don't think this would be an issue
here.
I will respin with a while loop so under no odd timing circumstance do we
break userland.
> --
> Thanks,
>
> David / dhildenb
>
prev parent reply other threads:[~2023-03-22 18:37 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
2023-03-22 18:36 ` Lorenzo Stoakes [this message]
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=bad5dc54-f614-430a-a6a2-e96fea6ce1ec@lucifer.local \
--to=lstoakes@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bhe@redhat.com \
--cc=david@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=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