Re: [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page
From: Segher Boessenkool
Date: Fri Jan 31 2020 - 14:39:04 EST
On Fri, Jan 31, 2020 at 05:15:20PM +0100, Christophe Leroy wrote:
> Le 31/01/2020 à 16:51, Segher Boessenkool a écrit :
> >On Fri, Jan 31, 2020 at 03:37:34PM +0000, Christophe Leroy wrote:
> >>When the range is a single page, do a page flush instead.
> >
> >>+ start &= PAGE_MASK;
> >>+ end = (end - 1) | ~PAGE_MASK;
> >> if (!Hash) {
> >>- _tlbia();
> >>+ if (end - start == PAGE_SIZE)
> >>+ _tlbie(start);
> >>+ else
> >>+ _tlbia();
> >> return;
> >> }
> >
> >For just one page, you get end - start == 0 actually?
>
> Oops, good catch.
>
> Indeed you don't get PAGE_SIZE but (PAGE_SIZE - 1) for just one page.
You have all low bits masked off in both start and end, so you get zero.
You could make the condion read "if (start == end)?
Maybe a nicer way to describe what you do is "if start and end are on the
same memory page, flush that page."
Segher