From: Christoph Hellwig <hch@infradead.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: mick@ics.forth.gr, mark.rutland@arm.com, gregory.0xf0@gmail.com,
peterz@infradead.org, catalin.marinas@arm.com,
linus.walleij@linaro.org,
Palmer Dabbelt <palmerdabbelt@google.com>,
brendanhiggins@google.com, elver@google.com, glider@google.com,
krzk@kernel.org, mchehab+samsung@kernel.org, will@kernel.org,
mingo@kernel.org, uwe@kleine-koenig.org,
takahiro.akashi@linaro.org, paulmck@kernel.org,
masahiroy@kernel.org, linux@armlinux.org.uk, willy@infradead.org,
rppt@linux.ibm.com, bgolaszewski@baylibre.com,
kernel-team@android.com, pmladek@suse.com,
zaslonko@linux.ibm.com, keescook@chromium.org,
Arnd Bergmann <arnd@arndb.de>,
broonie@kernel.org, matti.vaittinen@fi.rohmeurope.com,
ben-linux@fluff.org, dan.j.williams@intel.com,
linux-arm-kernel@lists.infradead.org, davidgow@google.com,
rdunlap@infradead.org, Nick Desaulniers <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org, mhiramat@kernel.org,
ardb@kernel.org, akpm@linux-foundation.org, davem@davemloft.net
Subject: Re: [PATCH 1/3] lib: Add a generic copy_oldmem_page()
Date: Mon, 13 Jul 2020 14:06:32 +0100 [thread overview]
Message-ID: <20200713130632.GA29945@infradead.org> (raw)
In-Reply-To: <20200711035544.2832154-2-palmer@dabbelt.com>
On Fri, Jul 10, 2020 at 08:55:42PM -0700, Palmer Dabbelt wrote:
> +ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
> + size_t csize, unsigned long offset,
> + int userbuf)
> +{
> + void *vaddr;
> +
> + if (!csize)
> + return 0;
> +
> + vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB);
> + if (!vaddr)
> + return -ENOMEM;
Doing a memremap for every page is very inefficient. Also I don't see
why you'd want to even do that. All memory is in the direct mapping
for RISC-V. For other architecture that support highmem kmap_atomic_pfn
would do the job, which is what I'd use in a generic version.
next prev parent reply other threads:[~2020-07-13 13:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-11 3:55 Add and use a generic copy_oldmem_page() Palmer Dabbelt
2020-07-11 3:55 ` [PATCH 1/3] lib: Add " Palmer Dabbelt
2020-07-13 13:06 ` Christoph Hellwig [this message]
2020-07-13 13:39 ` Arnd Bergmann
2020-07-14 11:05 ` Christoph Hellwig
2020-07-14 11:38 ` Arnd Bergmann
2020-07-15 7:03 ` Ard Biesheuvel
2020-07-11 3:55 ` [PATCH 2/3] arm: Use the new " Palmer Dabbelt
2020-07-16 12:54 ` Linus Walleij
2020-07-11 3:55 ` [PATCH 3/3] arm64: " Palmer Dabbelt
2020-07-14 20:37 ` Catalin Marinas
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=20200713130632.GA29945@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=ben-linux@fluff.org \
--cc=bgolaszewski@baylibre.com \
--cc=brendanhiggins@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=davidgow@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=gregory.0xf0@gmail.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mchehab+samsung@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mick@ics.forth.gr \
--cc=mingo@kernel.org \
--cc=ndesaulniers@google.com \
--cc=palmer@dabbelt.com \
--cc=palmerdabbelt@google.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=rppt@linux.ibm.com \
--cc=takahiro.akashi@linaro.org \
--cc=uwe@kleine-koenig.org \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=zaslonko@linux.ibm.com \
/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