Re: [PATCH] hfsplus: Convert kmap() to kmap_local_page() in bitmap.c

From: Fabio M. De Francesco
Date: Tue Jul 26 2022 - 08:04:21 EST


On lunedì 25 luglio 2022 19:17:13 CEST Viacheslav Dubeyko wrote:
>
> > On Jul 24, 2022, at 1:50 PM, Fabio M. De Francesco
<fmdefrancesco@xxxxxxxxx> wrote:
> >
> > kmap() is being deprecated in favor of kmap_local_page().
> >
> > There are 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).
> > It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
> > the tasks can be preempted and, when they are scheduled to run again,
the
> > kernel virtual addresses are restored and are still valid.
> >
> > Since its use in bitmap.c is safe everywhere, it should be preferred.
> >
> > Therefore, replace kmap() with kmap_local_page() in bnode.c.
> >
>
> Looks good. Maybe, it makes sense to combine all kmap() related
modifications in HFS+ into
> one patchset?
>
> Reviewed by: Viacheslav Dubeyko <slava@xxxxxxxxxxx>

Thanks for your reviews of this and of the other patch to bnode.c.

Actually, I started with the first file I met (bnode.c) because I noticed
that maintainers don't need to care about any special ordering for applying
the patches, since each of them is self-contained.

This is why I haven't thought of making a series of them.

Currently only one file is still left with some kmap() call sites. I'll
work on that within the next days.

Again thanks,

Fabio

> Thanks,
> Slava.
>
> > Suggested-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx>
> > ---
> > fs/hfsplus/bitmap.c | 18 +++++++++---------
> > 1 file changed, 9 insertions(+), 9 deletions(-)

[snip]