[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXEH2_=tx7jNNZO7T3JHuq2+AdoNuWUmUZBvGN4CUHm+6Q@mail.gmail.com>
Date: Wed, 15 Jul 2020 10:03:27 +0300
From: Ard Biesheuvel <ardb@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Palmer Dabbelt <palmer@...belt.com>, mick@....forth.gr,
Mark Rutland <mark.rutland@....com>, gregory.0xf0@...il.com,
Peter Zijlstra <peterz@...radead.org>,
Catalin Marinas <catalin.marinas@....com>,
Linus Walleij <linus.walleij@...aro.org>,
Palmer Dabbelt <palmerdabbelt@...gle.com>,
Brendan Higgins <brendanhiggins@...gle.com>,
Marco Elver <elver@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Krzysztof Kozlowski <krzk@...nel.org>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...nel.org>,
Uwe Kleine-König <uwe@...ine-koenig.org>,
takahiro.akashi@...aro.org,
"Paul E. McKenney" <paulmck@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Russell King <linux@...linux.org.uk>, willy@...radead.org,
Mike Rapoport <rppt@...ux.ibm.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Android Kernel Team <kernel-team@...roid.com>,
Petr Mladek <pmladek@...e.com>,
Mikhail Zaslonko <zaslonko@...ux.ibm.com>,
Kees Cook <keescook@...omium.org>,
Arnd Bergmann <arnd@...db.de>, Mark Brown <broonie@...nel.org>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Ben Dooks <ben-linux@...ff.org>,
Dan Williams <dan.j.williams@...el.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
David Gow <davidgow@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 1/3] lib: Add a generic copy_oldmem_page()
On Mon, 13 Jul 2020 at 16:06, Christoph Hellwig <hch@...radead.org> wrote:
>
> 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.
memremap(MEMREMAP_WB) will reuse the existing linear address if the PA
is covered by the linear mapping.
> 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.
Powered by blists - more mailing lists