original_kernel/include/asm-mips
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
..
dec
emma2rh
fw
ip32
jmr3927
lasat
mach-atlas
mach-au1x00 au1xxx-ide: fix MWDMA support 2008-04-26 22:25:22 +02:00
mach-bcm47xx
mach-cobalt
mach-db1x00 Pb1200/DBAu1200: fix bad IDE resource size 2008-04-17 01:14:33 +02:00
mach-dec
mach-emma2rh
mach-excite
mach-generic ide: remove ide_init_default_irq() macro 2008-04-18 00:46:35 +02:00
mach-ip22
mach-ip27
mach-ip28
mach-ip32
mach-jazz
mach-jmr3927
mach-lasat
mach-lemote
mach-mips
mach-mipssim
mach-pb1x00 Pb1200/DBAu1200: fix bad IDE resource size 2008-04-17 01:14:33 +02:00
mach-pnx8550
mach-rm
mach-sibyte
mach-tx49xx
mach-vr41xx
mach-wrppmc
mach-yosemite
mips-boards
pci
pmc-sierra/msp71xx
sgi
sibyte
sn
tx4927
tx4938
vr41xx
xtalk
Kbuild
a.out.h
abi.h
addrspace.h
asm.h
asmmacro-32.h
asmmacro-64.h
asmmacro.h
atomic.h
auxvec.h
barrier.h
bcache.h
bitops.h generic: implement __fls on all 64-bit archs 2008-04-26 19:21:16 +02:00
bootinfo.h
branch.h
break.h
bug.h
bugs.h
byteorder.h
cache.h
cachectl.h
cacheflush.h [MIPS] Handle aliases in vmalloc correctly. 2008-04-07 22:31:04 +01:00
cacheops.h
checksum.h
cmpxchg.h
compat-signal.h
compat.h
compiler.h
cpu-features.h
cpu-info.h
cpu.h
cputime.h
current.h
debug.h
delay.h
device.h
div64.h
dma-mapping.h
dma.h
ds1286.h
dsp.h
edac.h
elf.h
emergency-restart.h
errno.h
fb.h
fcntl.h
fixmap.h
floppy.h
fpregdef.h
fpu.h
fpu_emulator.h
futex.h
gdb-stub.h
gpio.h
gt64120.h
hardirq.h
hazards.h
highmem.h
hw_irq.h
i8253.h
i8259.h
ide.h
inst.h
inventory.h
io.h
ioctl.h
ioctls.h
ipcbuf.h
irq.h
irq_cpu.h
irq_gt641xx.h
irq_regs.h
irqflags.h
isadep.h
jazz.h
jazzdma.h
kdebug.h
kexec.h
kmap_types.h
kspd.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
m48t35.h
m48t37.h
mc146818-time.h
mc146818rtc.h
mips_mt.h
mipsmtregs.h
mipsprom.h
mipsregs.h
mman.h
mmu.h
mmu_context.h
mmzone.h
module.h
msc01_ic.h
msgbuf.h
mutex.h
namei.h
nile4.h
paccess.h
page.h
param.h
parport.h
pci.h
percpu.h
pgalloc.h
pgtable-32.h
pgtable-64.h
pgtable-bits.h
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pmon.h
poll.h
posix_types.h
prctl.h
prefetch.h
processor.h
ptrace.h
r4kcache.h
reboot.h
reg.h
regdef.h
resource.h
rm9k-ocd.h
rtlx.h
scatterlist.h
seccomp.h
sections.h
segment.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h
setup.h
sgialib.h
sgiarcs.h
sgidefs.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
sim.h
smp-ops.h
smp.h
smtc.h
smtc_ipi.h
smtc_proc.h
sni.h
socket.h
sockios.h
sparsemem.h
spinlock.h
spinlock_types.h
stackframe.h
stacktrace.h
stat.h
statfs.h
string.h
suspend.h
sysmips.h
system.h
termbits.h
termios.h
thread_info.h
time.h
timex.h
titan_dep.h
tlb.h
tlbdebug.h
tlbflush.h
topology.h
traps.h
txx9irq.h
txx9tmr.h
types.h
uaccess.h
ucontext.h
unaligned.h
unistd.h
user.h
vga.h
vpe.h
war.h
wbflush.h
xor.h