Re: [PATCH 04/31] x86/mm: Introduce pte_accessible()

From: Mel Gorman
Date: Thu Nov 01 2012 - 06:42:28 EST


On Thu, Oct 25, 2012 at 02:16:21PM +0200, Peter Zijlstra wrote:
> From: Rik van Riel <riel@xxxxxxxxxx>
>
> We need pte_present to return true for _PAGE_PROTNONE pages, to indicate that
> the pte is associated with a page.
>
> However, for TLB flushing purposes, we would like to know whether the pte
> points to an actually accessible page. This allows us to skip remote TLB
> flushes for pages that are not actually accessible.
>

It feels like we are putting the cart before the horse to be taking TLB
flushing optimisations into account this early in the series. That
aside, what was wrong with the following patches?

autonuma: define _PAGE_NUMA
arch-dependant definition of a flag that happens to be PROT_NONE
on x86 but could be anything at all really which would help portability

autonuma: pte_numa() and pmd_numa()
makes pte_present do what you want
adds pte_numa and pmd_numa which potentially could have been
used instead of pte_accessible

autonuma: teach gup_fast about pmd_numa
sortof self-explanatory

and building on those? The arch-dependant nature of _PAGE_NUMA might have
avoided Linus sending the childrens college fund to the swear jar and
avoided this complaint;

===
because you have no idea if other architectures do

(a) the same trick as x86 does for PROT_NONE (I can already tell you
from a quick grep that ia64, m32r, m68k and sh do it)
(b) might not perhaps be caching non-present pte's anyway
====

The "autonuma: define _PAGE_NUMA" happens to use PROT_NONE but as an
implementation detail rather than by design and as a bonus point describes
what it is doing. The "autonuma" part in the title is misleading, it's
not autonuma-specific at all and could have been dropped or just renamed
"numa:"

--
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/