linux/include/asm-m68k
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
..
a.out-core.h aout: suppress A.OUT library support if !CONFIG_ARCH_SUPPORTS_AOUT 2008-02-08 09:22:30 -08:00
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
adb_iop.h
amigahw.h
amigaints.h
amigayle.h
amipcmcia.h
apollodma.h
apollohw.h
atafd.h
atafdreg.h
atari_joystick.h
atari_stdma.h
atari_stram.h
atarihw.h
atariints.h
atarikb.h
atomic.h
auxvec.h
bitops.h ext4: Add ext4_find_next_bit() 2008-01-28 23:58:27 -05:00
blinken.h
bootinfo.h
bug.h
bugs.h
bvme6000hw.h
byteorder.h
cache.h
cachectl.h
cacheflush.h
checksum.h
contregs.h
cputime.h
current.h
delay.h
device.h
div64.h
dma-mapping.h
dma.h
dsp56k.h
dvma.h
elf.h Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed 2008-02-07 08:42:30 -08:00
emergency-restart.h
entry.h
errno.h
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fbio.h
fcntl.h
floppy.h cleanup floppy.h 2007-10-17 08:42:55 -07:00
fpu.h
futex.h
hardirq.h
hp300hw.h
hw_irq.h
hwtest.h
ide.h ide: add hwif->ack_intr hook 2007-10-20 00:32:32 +02:00
idprom.h
intersil.h
io.h Remove dma_cache_(wback|inv|wback_inv) functions 2007-10-17 08:42:57 -07:00
ioctl.h
ioctls.h m68k: Enable arbitary speed tty support 2007-08-22 19:52:45 -07:00
ipcbuf.h
irq_regs.h
irq.h take declarations of enable_irq() et.al. to linux/interrupt.h 2007-07-22 11:44:00 -07:00
Kbuild m68k: Export cachectl.h 2007-10-13 09:41:03 -07:00
kdebug.h
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h
local.h
mac_asc.h
mac_baboon.h
mac_iop.h
mac_mouse.h
mac_oss.h
mac_psc.h
mac_via.h
machdep.h
machines.h
machw.h
macintosh.h mac68k: remove dead code 2008-02-05 09:44:24 -08:00
macints.h
math-emu.h
mc146818rtc.h
md.h
mman.h
mmu_context.h
mmu.h
mmzone.h m68k: discontinuous memory support 2007-05-31 07:58:14 -07:00
module.h m68k: discontinuous memory support 2007-05-31 07:58:14 -07:00
motorola_pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
motorola_pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
movs.h
msgbuf.h
mutex.h
mvme16xhw.h
mvme147hw.h
namei.h
nubus.h
openprom.h
oplib.h
page_offset.h
page.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
param.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
parport.h
pci.h PCI: Use a weak symbol for the empty version of pcibios_add_platform_entries() 2007-07-11 16:02:07 -07:00
percpu.h
pgalloc.h m68k: discontinuous memory support 2007-05-31 07:58:14 -07:00
pgtable.h cleanup after APUS removal 2008-02-06 10:41:01 -08:00
poll.h
posix_types.h asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
processor.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
ptrace.h
q40_master.h
q40ints.h
raw_io.h m68k {in,out}_le{16,32} endianness misannotation 2007-07-26 11:11:57 -07:00
resource.h
rtc.h
sbus.h
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h
setup.h
shm.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h
spinlock.h
stat.h
statfs.h
string.h
sun3_pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
sun3_pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
sun3-head.h
sun3ints.h
sun3mmu.h
sun3x.h
sun3xflop.h
sun3xprom.h
suspend.h
system.h Add cmpxchg_local to m86k 2008-02-07 08:42:32 -08:00
termbits.h m68k: Enable arbitary speed tty support 2007-08-22 19:52:45 -07:00
termios.h m68k: Enable arbitary speed tty support 2007-08-22 19:52:45 -07:00
thread_info.h
timex.h
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
traps.h
types.h remove strict ansi check from __u64 in asm/types.h 2007-10-17 08:42:53 -07:00
uaccess.h
ucontext.h
unaligned.h
unistd.h m68k{,nommu}: Wire up new timerfd syscalls 2008-03-04 08:04:11 -08:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
virtconvert.h m68k: discontinuous memory support 2007-05-31 07:58:14 -07:00
xor.h
zorro.h