linux-sg2042/include/asm-ppc
Nick Piggin 7e675137a8 mm: introduce pte_special pte bit
s390 for one, cannot implement VM_MIXEDMAP with pfn_valid, due to their memory
model (which is more dynamic than most).  Instead, they had proposed to
implement it with an additional path through vm_normal_page(), using a bit in
the pte to determine whether or not the page should be refcounted:

vm_normal_page()
{
	...
        if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
                if (vma->vm_flags & VM_MIXEDMAP) {
#ifdef s390
			if (!mixedmap_refcount_pte(pte))
				return NULL;
#else
                        if (!pfn_valid(pfn))
                                return NULL;
#endif
                        goto out;
                }
	...
}

This is fine, however if we are allowed to use a bit in the pte to determine
refcountedness, we can use that to _completely_ replace all the vma based
schemes.  So instead of adding more cases to the already complex vma-based
scheme, we can have a clearly seperate and simple pte-based scheme (and get
slightly better code generation in the process):

vm_normal_page()
{
#ifdef s390
	if (!mixedmap_refcount_pte(pte))
		return NULL;
	return pte_page(pte);
#else
	...
#endif
}

And finally, we may rather make this concept usable by any architecture rather
than making it s390 only, so implement a new type of pte state for this.
Unfortunately the old vma based code must stay, because some architectures may
not be able to spare pte bits.  This makes vm_normal_page a little bit more
ugly than we would like, but the 2 cases are clearly seperate.

So introduce a pte_special pte state, and use it in mm/memory.c.  It is
currently a noop for all architectures, so this doesn't actually result in any
compiled code changes to mm/memory.o.

BTW:
I haven't put vm_normal_page() into arch code as-per an earlier suggestion.
The reason is that, regardless of where vm_normal_page is actually
implemented, the *abstraction* is still exactly the same. Also, while it
depends on whether the architecture has pte_special or not, that is the
only two possible cases, and it really isn't an arch specific function --
the role of the arch code should be to provide primitive functions and
accessors with which to build the core code; pte_special does that. We do
not want architectures to know or care about vm_normal_page itself, and
we definitely don't want them being able to invent something new there
out of sight of mm/ code. If we made vm_normal_page an arch function, then
we have to make vm_insert_mixed (next patch) an arch function too. So I
don't think moving it to arch code fundamentally improves any abstractions,
while it does practically make the code more difficult to follow, for both
mm and arch developers, and easier to misuse.

[akpm@linux-foundation.org: build fix]
Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Cc: Jared Hulbert <jaredeh@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:23 -07:00
..
8xx_immap.h [POWERPC] include/asm-ppc/: Spelling fixes 2007-12-20 16:17:49 +11:00
amigayle.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amipcmcia.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bootinfo.h [POWERPC] Remove APUS support from arch/ppc 2007-09-17 15:15:04 +10:00
bootx.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
btext.h [PATCH] powerpc: Unify udbg (#2) 2006-01-09 14:49:54 +11:00
cpm1.h [POWERPC] CPM: Rename commproc to cpm1 and cpm2_common.c to cpm2.c 2008-01-28 08:31:05 -06:00
cpm2.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
delay.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
floppy.h cleanup floppy.h 2007-10-17 08:42:55 -07:00
fs_pd.h POWERPC: Get rid of remapping the whole immr 2006-09-21 22:37:58 +04:00
gg2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gt64260.h [POWERPC] ARCH=ppc pt_regs fixes 2006-10-10 11:55:25 +10:00
gt64260_defs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
harrier.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
hawk.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hawk_defs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
highmem.h [PATCH] mm: pagefault_{disable,enable}() 2006-12-07 08:39:21 -08:00
hydra.h include files: convert "include" subdirectory to UTF-8 2007-05-09 08:58:21 +02:00
ibm4xx.h [POWERPC] Merge common virtex header files 2007-04-30 11:02:04 +10:00
ibm44x.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ibm403.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ibm405.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ibm_ocp.h [PATCH] ppc32: remove "jumbo" member from ocp_func_emac_data 2006-01-06 08:33:30 -08:00
ibm_ocp_pci.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
immap_cpm2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
io.h Remove dma_cache_(wback|inv|wback_inv) functions 2007-10-17 08:42:57 -07:00
irq_regs.h softlockup: make asm/irq_regs.h available on every platform 2007-10-17 08:42:47 -07:00
kdebug.h move die notifier handling to common code 2007-05-08 11:15:04 -07:00
kgdb.h [PATCH] ppc: Fix ARCH=ppc build with xmon 2005-11-08 11:19:48 +11:00
m8260_pci.h [PATCH] ppc32: Support for 82xx PQII on-chip PCI bridge 2005-05-28 16:46:15 -07:00
machdep.h [POWERPC] Remove APUS support from arch/ppc 2007-09-17 15:15:04 +10:00
md.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mk48t59.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmu.h [POWERPC] 4xx: Fix duplicate phys_addr_t definition 2008-04-24 20:57:34 +10:00
mmu_context.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
mpc8xx.h [PPC] Remove mpc885ads and mpc86x ads boards from arch/ppc 2008-04-21 10:19:09 -05:00
mpc10x.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
mpc52xx.h [PATCH] ppc: Fix io.h for config with CONFIG_PCI not set 2006-11-13 14:49:25 +11:00
mpc52xx_psc.h [POWERPC] Separate MPC52xx PSC FIFO registers from rest of PSC 2008-01-21 11:01:32 -07:00
mpc8260.h [PPC] Remove mpc8272 ads board from arch/ppc 2008-04-21 10:19:09 -05:00
mpc8260_pci9.h [POWERPC] remove unused io accessors 2006-09-20 14:06:17 +10:00
mv64x60.h [WATCHDOG] mv64x60_wdt: Add arch/powerpc platform support 2007-07-24 21:16:02 +00:00
mv64x60_defs.h fix file specification in comments 2006-10-03 23:01:26 +02:00
ocp.h include: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:54 -04:00
ocp_ids.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
open_pic.h [POWERPC] PReP fixup after irq changes 2006-10-07 22:11:20 +10:00
page.h [POWERPC] Fix arch/ppc compilation - add typedef for pgtable_t 2008-02-14 22:11:02 +11:00
pc_serial.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pci-bridge.h [POWERPC] Fix mmap of PCI resource with hack for X 2006-12-08 17:21:06 +11:00
pci.h PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pnp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ppc4xx_dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ppc4xx_pic.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ppc_sys.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
ppcboot.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
prep_nvram.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
prom.h [POWERPC] Remove get_property and device_is_compatible 2007-08-17 11:01:58 +10:00
raven.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
reg_booke.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
residual.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rio.h [PATCH] RapidIO support: ppc32 2005-11-07 07:53:47 -08:00
rtc.h fix file specification in comments 2006-10-03 23:01:26 +02:00
serial.h [PPC] Remove 85xx from arch/ppc 2008-01-28 08:33:10 -06:00
smp.h [POWERPC] PReP fixup after irq changes 2006-10-07 22:11:20 +10:00
spinlock.h [PATCH] Directed yield: cpu_relax variants for spinlocks and rw-locks 2006-10-01 00:39:21 -07:00
suspend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h Add cmpxchg_local to ppc 2008-02-07 08:42:32 -08:00
time.h Replace __attribute_pure__ with __pure 2007-10-18 14:37:32 -07:00
todc.h [PATCH] powerpc: trivial: modify comments to refer to new location of files 2006-02-10 16:53:51 +11:00
traps.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
zorro.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00