android_kernel_xiaomi_sm8350/include/asm-powerpc
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
..
iseries [POWERPC] iSeries: Localise and constify some iSeries data 2008-04-15 21:21:25 +10:00
8xx_immap.h
8253pit.h
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
abs_addr.h [LIB]: Make PowerPC LMB code generic so sparc64 can use it too. 2008-02-13 16:56:49 -08:00
agp.h x86: remove flush_agp_mappings() 2008-01-30 13:34:07 +01:00
asm-compat.h
atomic.h
auxvec.h
backlight.h
bitops.h generic: implement __fls on all 64-bit archs 2008-04-26 19:21:16 +02:00
bootx.h
btext.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
clk_interface.h
compat.h asm-*/compat.h: fix typo in comment 2008-02-03 16:32:51 +02:00
cpm1.h [POWERPC] CPM: Move opcodes common to CPM1 and CPM2 to include/asm-powerpc/cpm.h 2008-04-17 01:01:37 -05:00
cpm2.h [POWERPC] CPM: Move opcodes common to CPM1 and CPM2 to include/asm-powerpc/cpm.h 2008-04-17 01:01:37 -05:00
cpm.h [POWERPC] CPM: Move opcodes common to CPM1 and CPM2 to include/asm-powerpc/cpm.h 2008-04-17 01:01:37 -05:00
cputable.h [POWERPC] Made FSL Book-E PMC support more generic 2008-02-05 23:34:14 -06:00
cputhreads.h [POWERPC] Fix thinko in cpu_thread_mask_to_cores() 2008-02-26 22:17:03 +11:00
cputime.h taskstats scaled time cleanup 2008-02-06 10:41:00 -08:00
current.h
dbdma.h
dcr-mmio.h
dcr-native.h [POWERPC] 4xx: Add dcri_clrset() for locked read/modify/write functionality 2008-03-26 07:20:38 -05:00
dcr-regs.h [POWERPC] 4xx: Add PPC4xx L2-cache support (440GX) 2008-03-26 07:27:54 -05:00
dcr.h
delay.h
device.h
div64.h
dma-mapping.h [POWERPC] Add set_dma_ops() to match get_dma_ops() 2008-01-31 12:11:09 +11:00
dma.h scheduled OSS driver removal 2008-02-06 10:41:02 -08:00
edac.h
eeh_event.h
eeh.h
elf.h [POWERPC] Switch to generic compat_binfmt_elf code 2008-02-07 20:40:18 +11:00
emergency-restart.h
errno.h
exception.h [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
fb.h
fcntl.h
firmware.h
fixmap.h [POWERPC] Port fixmap from x86 and use for kmap_atomic 2008-04-24 20:58:02 +10:00
floppy.h
fs_pd.h
fsl_lbc.h [POWERPC] fsl_lbc: implement few UPM routines 2008-04-17 01:01:38 -05:00
futex.h
gpio.h [POWERPC] Implement support for the GPIO LIB API 2008-04-17 07:46:11 +10:00
grackle.h
hardirq.h
heathrow.h
highmem.h [POWERPC] Port fixmap from x86 and use for kmap_atomic 2008-04-24 20:58:02 +10:00
hvcall.h
hvconsole.h
hvcserver.h
hw_irq.h [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
hydra.h
i8259.h
ibmebus.h
ide.h ide: remove ide_init_default_irq() macro 2008-04-18 00:46:35 +02:00
immap_86xx.h
immap_cpm2.h
immap_qe.h [POWERPC] QE: immap_qe.h should include asm/io.h 2008-04-17 01:01:39 -05:00
io-defs.h [POWERPC] cell: Generalize io-workarounds code 2008-04-24 21:08:12 +10:00
io.h [POWERPC] cell: Generalize io-workarounds code 2008-04-24 21:08:12 +10:00
ioctl.h
ioctls.h
iommu.h iommu sg: powerpc: convert iommu to use the IOMMU helper 2008-02-05 09:44:11 -08:00
ipcbuf.h
ipic.h
irq_regs.h
irq.h
irqflags.h [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
Kbuild [POWERPC] Move a.out.h to header-y since it doesn't check __KERNEL__ 2008-03-26 08:44:07 +11:00
kdebug.h
kdump.h [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero) 2008-04-24 20:58:01 +10:00
kexec.h
keylargo.h
kgdb.h
kmap_types.h
kprobes.h Kprobes: indicate kretprobe support in Kconfig 2008-03-04 16:35:11 -08:00
kvm_asm.h KVM: ppc: PowerPC 440 KVM implementation 2008-04-27 18:21:39 +03:00
kvm_host.h KVM: ppc: PowerPC 440 KVM implementation 2008-04-27 18:21:39 +03:00
kvm_para.h KVM: ppc: PowerPC 440 KVM implementation 2008-04-27 18:21:39 +03:00
kvm_ppc.h KVM: ppc: PowerPC 440 KVM implementation 2008-04-27 18:21:39 +03:00
kvm.h KVM: ppc: PowerPC 440 KVM implementation 2008-04-27 18:21:39 +03:00
libata-portmap.h
linkage.h
lmb.h [POWERPC] Use lowmem_end_addr to limit lmb allocations on ppc32 2008-04-17 07:46:13 +10:00
local.h
lppaca.h
lv1call.h
machdep.h [POWERPC] Remove unused machine call outs 2008-04-17 10:01:00 +10:00
macio.h [POWERPC] replace asm/of_device.h with linux/of_device.h in macio.h 2008-04-15 21:21:26 +10:00
mc146818rtc.h
mediabay.h ide: rework PowerMac media-bay support (take 2) 2008-04-18 00:46:23 +02:00
mman.h
mmu_context.h
mmu-8xx.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
mmu-40x.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
mmu-44x.h ppc: Export tlb_44x_hwater for KVM 2008-04-27 18:21:37 +03:00
mmu-fsl-booke.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
mmu-hash32.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
mmu-hash64.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
mmu.h
mmzone.h
module.h
mpc8xx.h
mpc52xx_psc.h [POWERPC] mpc512x: Add MPC512x PSC support to MPC52xx psc driver 2008-02-06 14:05:40 -07:00
mpc52xx.h
mpc86xx.h
mpc512x.h [POWERPC] mpc512x: Basic platform support 2008-02-06 14:03:10 -07:00
mpc8260.h
mpic.h
msgbuf.h
mutex.h
namei.h
nvram.h include/asm-powerpc/nvram.h needs list.h 2008-02-05 09:44:08 -08:00
of_device.h
of_platform.h
ohare.h
oprofile_impl.h [POWERPC] Made FSL Book-E PMC support more generic 2008-02-05 23:34:14 -06:00
paca.h [POWERPC] Raise the upper limit of NR_CPUS and move the pacas into the BSS 2008-04-24 20:58:04 +10:00
page_32.h [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero) 2008-04-24 20:58:01 +10:00
page_64.h Cleanup asm/{elf,page,user}.h: #ifdef __KERNEL__ is no longer needed 2008-02-07 08:42:30 -08:00
page.h [POWERPC] 85xx: Add support for relocatable kernel (and booting at non-zero) 2008-04-24 20:58:01 +10:00
param.h
parport.h
pasemi_dma.h pasemi_mac: jumbo frame support 2008-03-05 16:34:39 -06:00
pci-bridge.h [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const 2008-04-18 15:37:14 +10:00
pci.h
percpu.h percpu: fix DEBUG_PREEMPT per_cpu checking 2008-02-23 12:09:28 -08:00
pgalloc-32.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgalloc-64.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgalloc.h
pgtable-4k.h
pgtable-64k.h
pgtable-ppc32.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pgtable-ppc64.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pgtable.h
phyp_dump.h [POWERPC] pseries/phyp dump: Reserve a variable amount of space at boot 2008-04-17 07:46:14 +10:00
pmac_feature.h [POWERPC] Disable G5 NAP mode during SMU commands on U3 2008-02-08 19:52:35 +11:00
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h [POWERPC] remove include of asm/of_device.h from pmi.h 2008-04-15 21:21:25 +10:00
poll.h
posix_types.h asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
ppc4xx.h [POWERPC] 4xx: Create common ppc4xx_reset_system() in ppc4xx_soc.c 2008-04-02 20:44:56 -05:00
ppc_asm.h
ppc-pci.h
processor.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
prom.h
ps3.h [POWERPC] PS3: Sys-manager Wake-on-LAN support 2008-04-01 20:43:08 +11:00
ps3av.h ps3: use symbolic names for video modes 2008-02-06 10:41:17 -08:00
ps3fb.h
ps3stor.h
pSeries_reconfig.h
ptrace.h [POWERPC] Move stackframe definitions to common header 2008-04-18 15:37:18 +10:00
qe_ic.h
qe.h [POWERPC] QE: export qe_get_brg_clk() 2008-04-17 01:01:39 -05:00
reg_8xx.h
reg_booke.h [POWERPC] Made FSL Book-E PMC support more generic 2008-02-05 23:34:14 -06:00
reg_fsl_emb.h [POWERPC] Made FSL Book-E PMC support more generic 2008-02-05 23:34:14 -06:00
reg.h [POWERPC] move celleb DABRX definitions 2008-03-03 08:03:14 +01:00
resource.h
rheap.h
rtas.h
rtc.h
rwsem.h [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
scatterlist.h
seccomp.h
sections.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
serial.h
setjmp.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h
smu.h
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h
sparsemem.h [POWERPC] Add error return from htab_remove_mapping() 2008-04-01 20:43:08 +11:00
spinlock_types.h
spinlock.h [POWERPC] irqtrace support for 64-bit powerpc 2008-04-18 15:38:47 +10:00
spu_csa.h
spu_info.h
spu_priv1.h
spu.h [POWERPC] cell: fix spurious false return from spu_trap_data_{map,seg} 2008-02-20 14:57:36 +11:00
sstep.h
stat.h
statfs.h
string.h [POWERPC] Add hand-coded assembly strcmp 2008-04-07 10:03:03 +10:00
suspend.h
synch.h
syscalls.h
systbl.h [POWERPC] Wire up new timerfd syscalls 2008-02-14 22:11:01 +11:00
system.h [POWERPC] Fix compile breakage for 64-bit UP configs 2008-04-20 17:57:10 +10:00
tce.h
termbits.h
termios.h
thread_info.h [POWERPC] Fix kernel stack allocation alignment 2008-04-24 20:57:33 +10:00
time.h
timex.h
tlb.h
tlbflush.h
topology.h asm-generic: add node_to_cpumask_ptr macro 2008-04-19 19:44:58 +02:00
tsi108_irq.h
tsi108_pci.h
tsi108.h
types.h [POWERPC] Move phys_addr_t definition into asm/types.h 2008-04-17 07:46:14 +10:00
uaccess.h
ucc_fast.h
ucc_slow.h
ucc.h
ucontext.h
udbg.h
uic.h
unaligned.h
uninorth.h
unistd.h [POWERPC] Wire up new timerfd syscalls 2008-02-14 22:11:01 +11:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
vdso_datapage.h
vdso.h
vga.h
vio.h [POWERPC] iSeries: Fix section mismatch in viodsasd 2008-02-06 16:30:00 +11:00
xilinx_intc.h
xmon.h
xor.h