[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YthzxUOgyPKgiyPY@bombadil.infradead.org>
Date: Wed, 20 Jul 2022 14:29:41 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc: Matthew Wilcox <willy@...radead.org>,
Ira Weiny <ira.weiny@...el.com>, linux-modules@...r.kernel.org,
linux-kernel@...r.kernel.org, Song Liu <song@...nel.org>,
Takashi Iwai <tiwai@...e.de>,
Adam Manzanares <a.manzanares@...sung.com>,
Davidlohr Bueso <dave@...olabs.net>,
Matthew Wilcox <willy@...ff-1.hugedomains.com>
Subject: Re: [PATCH v2] module: Replace kmap() with kmap_local_page()
On Wed, Jul 20, 2022 at 06:19:32PM +0200, Fabio M. De Francesco wrote:
> kmap() is being deprecated in favor of kmap_local_page().
>
> Two main problems with kmap(): (1) It comes with an overhead as mapping
> space is restricted and protected by a global lock for synchronization and
> (2) it also requires global TLB invalidation when the kmap’s pool wraps
> and it might block when the mapping space is fully utilized until a slot
> becomes available.
>
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> Tasks can be preempted and, when scheduled to run again, the kernel
> virtual addresses are restored and still valid.
>
> kmap_local_page() is faster than kmap() in kernels with HIGHMEM enabled.
>
> Since the use of kmap_local_page() in module_gzip_decompress() and in
> module_xz_decompress() is safe (i.e., it does not break the strict rules
> of use), it should be preferred over kmap().
>
> Therefore, replace kmap() with kmap_local_page().
>
> Tested on a QEMU/KVM x86_32 VM with 4GB RAM, booting kernels with
> HIGHMEM64GB enabled. Modules compressed with XZ or GZIP decompress
> properly.
>
> Cc: Matthew Wilcox <willy@...radead.com>
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
Thanks for the enhanced commit log! Queued onto modules-testing, if that
doesn't blow something up I'll move to modules-next afterwards.
Luis
Powered by blists - more mailing lists