android_kernel_xiaomi_sm8350/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 [MIPS] CFE: Make code remotely resemble Linux code. 2008-01-29 10:14:55 +00:00
ip32 [MIPS] IP32: More interrupt renumbering fixes. 2007-11-26 17:26:13 +00:00
jmr3927 [MIPS] txx9tmr clockevent/clocksource driver 2007-10-29 19:35:35 +00:00
lasat [MIPS] Lasat: Fix overlap of interrupt number ranges. 2007-11-15 23:21:50 +00:00
mach-atlas
mach-au1x00 au1xxx-ide: fix MWDMA support 2008-04-26 22:25:22 +02:00
mach-bcm47xx
mach-cobalt [MIPS] remove unneeded button check for reset 2008-01-29 10:15:00 +00:00
mach-db1x00 Pb1200/DBAu1200: fix bad IDE resource size 2008-04-17 01:14:33 +02:00
mach-dec
mach-emma2rh
mach-excite include/asm-mips/: Spelling fixes 2008-02-03 16:57:20 +02:00
mach-generic ide: remove ide_init_default_irq() macro 2008-04-18 00:46:35 +02:00
mach-ip22
mach-ip27 [MIPS] IP27: Tighten up CPU description to fix warnings. 2008-03-12 14:14:41 +00:00
mach-ip28 [MIPS] IP28 support 2008-01-29 10:14:58 +00:00
mach-ip32
mach-jazz [MIPS] Fix and cleanup the MIPS part of the (ab)use of CLOCK_TICK_RATE. 2007-11-02 16:13:48 +00:00
mach-jmr3927 [MIPS] Fix plat_ioremap for JMR3927 2008-03-12 14:14:41 +00:00
mach-lasat [MIPS] Lasat: fix LASAT_CASCADE_IRQ 2008-03-12 14:14:42 +00:00
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 [MIPS] Fix and cleanup the MIPS part of the (ab)use of CLOCK_TICK_RATE. 2007-11-02 16:13:48 +00:00
mach-sibyte
mach-tx49xx
mach-vr41xx
mach-wrppmc include/asm-mips/: Spelling fixes 2008-02-03 16:57:20 +02:00
mach-yosemite
mips-boards [MIPS] Malta, Atlas: move an extern function declaration to the header file 2008-01-29 10:15:05 +00:00
pci Fix misspellings of "system", "controller", "interrupt" and "necessary". 2007-10-19 23:10:43 +02:00
pmc-sierra/msp71xx [MIPS] Delete CONFIG_MSP_FPGA 2008-01-29 10:15:01 +00:00
sgi include/asm-mips/: Spelling fixes 2008-02-03 16:57:20 +02:00
sibyte [MIPS] Remove CONFIG_SIBYTE_PT{1120,1125,SWARM} 2008-01-29 10:14:58 +00:00
sn include/asm-mips/: Spelling fixes 2008-02-03 16:57:20 +02:00
tx4927 [MIPS] TXx9 watchdog support for rbhma3100,rbhma4200,rbhma4500 2008-01-29 10:14:58 +00:00
tx4938 [MIPS] txx9tmr clockevent/clocksource driver 2007-10-29 19:35:35 +00:00
vr41xx
xtalk
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
abi.h
addrspace.h [MIPS] Put cast inside macro instead of all the callers 2008-01-29 10:14:55 +00:00
asm.h [MIPS] IP28: added cache barrier to assembly routines 2008-01-29 10:14:58 +00:00
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 [MIPS] RM: Collected changes 2008-01-29 10:14:59 +00:00
branch.h
break.h
bug.h
bugs.h [MIPS] R4000/R4400 errata workarounds 2008-01-29 10:14:54 +00:00
byteorder.h
cache.h
cachectl.h
cacheflush.h [MIPS] Handle aliases in vmalloc correctly. 2008-04-07 22:31:04 +01:00
cacheops.h [MIPS] Cacheops.h: Fix typo. 2008-01-15 01:04:42 +00:00
checksum.h
cmpxchg.h Add cmpxchg64 and cmpxchg64_local to mips 2008-02-07 08:42:30 -08:00
compat-signal.h
compat.h asm-*/compat.h: fix typo in comment 2008-02-03 16:32:51 +02:00
compiler.h
cpu-features.h [MIPS] Fix use of smp_processor_id() in preemptible code. 2007-12-01 00:39:37 +00:00
cpu-info.h [MIPS] MT: Scheduler support for SMT 2008-01-29 10:14:57 +00:00
cpu.h [MIPS] Alchemy: Au1210/Au1250 CPU support 2008-01-29 10:14:59 +00:00
cputime.h
current.h
debug.h
delay.h [MIPS] R4000/R4400 daddiu erratum workaround 2008-01-29 10:14:55 +00:00
device.h
div64.h
dma-mapping.h
dma.h [MIPS] IP28 support 2008-01-29 10:14:58 +00:00
ds1286.h
dsp.h
edac.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
errno.h
fb.h
fcntl.h
fixmap.h [MIPS] fixmap: delete unused __set_fixmap, set_fixmap and set_fixmap_nocache 2008-01-29 10:15:00 +00:00
floppy.h
fpregdef.h
fpu_emulator.h
fpu.h remove asm/bitops.h includes 2007-10-19 11:53:41 -07:00
futex.h [MIPS] Fix possible hang in LL/SC futex loops. 2007-11-26 17:26:14 +00:00
gdb-stub.h
gpio.h
gt64120.h [MIPS] time: Add GT641xx timer0 clockevent driver 2007-10-22 22:09:00 +01:00
hardirq.h
hazards.h
highmem.h [MIPS] Fix yosemite build error 2008-03-12 14:14:42 +00:00
hw_irq.h
i8253.h [MIPS] Fix pcspeaker build. 2007-11-26 17:26:13 +00:00
i8259.h
ide.h
inst.h
inventory.h
io.h
ioctl.h
ioctls.h
ipcbuf.h
irq_cpu.h
irq_gt641xx.h
irq_regs.h
irq.h
irqflags.h
isadep.h
jazz.h
jazzdma.h
Kbuild
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 [MIPS] RM: Collected changes 2008-01-29 10:14:59 +00:00
mipsregs.h
mman.h
mmu_context.h
mmu.h
mmzone.h
module.h
msc01_ic.h
msgbuf.h
mutex.h
namei.h
nile4.h
paccess.h
page.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
param.h
parport.h
pci.h
percpu.h
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgtable-32.h [MIPS] Fix yosemite build error 2008-03-12 14:14:42 +00:00
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 asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
prctl.h
prefetch.h
processor.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
ptrace.h
r4kcache.h [MIPS] Use real cache invalidate 2008-01-29 10:14:57 +00:00
reboot.h
reg.h
regdef.h
resource.h
rm9k-ocd.h
rtlx.h
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
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 [MIPS] SMP: Call platform methods via ops structure. 2008-01-29 10:14:57 +00:00
smp.h [MIPS] SMP: Call platform methods via ops structure. 2008-01-29 10:14:57 +00:00
smtc_ipi.h [MIPS] SMTC: Fix build error. 2008-01-22 00:35:23 +00:00
smtc_proc.h
smtc.h
sni.h [MIPS] RM: fix EISA=n compilation 2008-02-19 17:01:34 +00:00
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h
stackframe.h [MIPS] R4000/R4400 daddiu erratum workaround 2008-01-29 10:14:55 +00:00
stacktrace.h
stat.h
statfs.h
string.h
suspend.h
sysmips.h
system.h IP22ZILOG: fix lockup and sysrq 2007-11-29 09:24:53 -08:00
termbits.h
termios.h
thread_info.h
time.h [MIPS] Clocksource: Only install r4k counter as clocksource if present. 2008-03-12 14:14:42 +00:00
timex.h [MIPS] Change get_cycles to always return 0. 2007-11-15 23:21:49 +00:00
titan_dep.h
tlb.h
tlbdebug.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h [MIPS] MT: Scheduler support for SMT 2008-01-29 10:14:57 +00:00
traps.h
txx9irq.h
txx9tmr.h [MIPS] txx9tmr clockevent/clocksource driver 2007-10-29 19:35:35 +00:00
types.h
uaccess.h [MIPS] R4000/R4400 daddiu erratum workaround 2008-01-29 10:14:55 +00:00
ucontext.h
unaligned.h
unistd.h [MIPS] Wire up the timerfd_*() o32 system calls 2008-02-19 17:01:31 +00:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
vga.h
vpe.h
war.h [MIPS] R4000/R4400 errata workarounds 2008-01-29 10:14:54 +00:00
wbflush.h
xor.h