Re: [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()

From: Ira Weiny
Date: Fri Jan 27 2023 - 18:07:59 EST


Matthew Wilcox wrote:
> On Thu, Jan 26, 2023 at 09:37:08PM +0100, Helge Deller wrote:
> > > This 'fixes' looks correct to me. I don't know how many folks are running
> > > highmem with parisc but if they are I am sure they would appreciate the
> > > extra knowledge.
> >
> > It seems nobody is running highmem on parisc, because it can't be enabled.
> > AFAICS, it's not in any parisc related Kconfig file.
>
> But this isn't being used for highmem on parisc; it's being used for
> cache coherency.

<sigh> right! I missed that. Thanks to you and Al for setting me
straight.

>
> > > I do wonder if this should be cc'ed to stable to ensure it gets
> > > backported? Helge do you think there is a need for that?
> >
> > For correctness I think it's nevertheless good to backport it.
>
> I cc'd stable on my version of this patch, and included a Fixes tag
> to indicate how far back to backport it.

Thanks!

>
> > That would be another possibility:
> >
> > diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
> > index 0bdee6724132..ce5d1f8a23bd 100644
> > --- a/arch/parisc/include/asm/cacheflush.h
> > +++ b/arch/parisc/include/asm/cacheflush.h
> > @@ -77,6 +77,7 @@ void flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned lon
> > #define ARCH_HAS_FLUSH_ON_KUNMAP
> > static inline void kunmap_flush_on_unmap(const void *addr)
> > {
> > + addr = PTR_ALIGN_DOWN(addr, PAGE_SIZE);
>
> I considered that, but thought it a shame to do it here when all the
> other users are passing in a page-aligned address.
>

I think this also keeps the kunmap_local() API intact better.

Patch reviewed.

Thanks!
Ira