android_kernel_motorola_sm6225/include/asm-avr32
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
..
arch-at32ap avr32: Generic clockevents support 2008-04-19 20:40:08 -04:00
mach [PATCH] atmel_serial: Rename at91_register_uart_fns 2006-10-04 10:25:05 -07:00
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
addrspace.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
asm.h avr32: Use constants from sysreg.h in asm.h 2008-04-19 20:40:07 -04:00
atomic.h [AVR32] Fix atomic_add_unless() and atomic_sub_unless() 2007-07-18 20:47:04 +02:00
auxvec.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
bitops.h forbid asm/bitops.h direct inclusion 2007-10-19 11:53:41 -07:00
bug.h Fix WARN_ON() on bitfield ops for all other archs 2007-08-01 20:45:38 -07:00
bugs.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
byteorder.h avr32: Work around byteswap bug in gcc < 4.2 2008-03-10 13:32:33 +01:00
cache.h [AVR32] Define ARCH_KMALLOC_MINALIGN to L1_CACHE_BYTES 2007-06-14 18:30:50 +02:00
cachectl.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
cacheflush.h [AVR32] Fix copy_to_user_page() breakage 2007-12-07 14:54:47 +01:00
checksum.h Remove a couple final references to obsolete verify_area(). 2007-02-09 15:01:56 +01:00
cputime.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
current.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
delay.h Fix __const_udelay declaration and definition mismatches 2008-02-06 10:41:06 -08:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
div64.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
dma-mapping.h AVR32: Fix sg_page breakage 2007-10-24 10:16:02 +02:00
dma.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
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 [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
errno.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
futex.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
gpio.h [AVR32] GPIO API implementation 2007-02-09 15:01:58 +01:00
hardirq.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
hw_irq.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
io.h Remove dma_cache_(wback|inv|wback_inv) functions 2007-10-17 08:42:57 -07:00
ioctl.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
ioctls.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
ipcbuf.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
irq.h avr32: Delete mostly unused header asm/intc.h 2008-04-19 20:40:07 -04:00
irq_regs.h [PATCH] IRQ: Fix AVR32 breakage 2006-10-11 11:14:14 -07:00
irqflags.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
Kbuild [AVR32] Fix typo in include/asm-avr32/Kbuild 2007-03-07 10:50:27 +01:00
kdebug.h [AVR32] NMI debugging 2008-01-25 08:31:43 +01:00
kmap_types.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
kprobes.h kprobes: support kretprobe blacklist 2007-10-16 09:43:10 -07:00
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
local.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
mman.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
mmu.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
mmu_context.h [PATCH] x86: PARAVIRT: add hooks to intercept mm creation and destruction 2007-05-02 19:27:14 +02:00
module.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
msgbuf.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
mutex.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
namei.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
numnodes.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
ocd.h [AVR32] Enable debugging only when needed 2008-01-25 08:31:39 +01:00
page.h avr32: cleanup - use _AC macro to define PAGE_SIZE 2008-04-19 20:40:06 -04:00
param.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
pci.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
percpu.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgtable-2level.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
poll.h Consolidate asm/poll.h 2007-05-11 08:29:34 -07:00
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 [AVR32] Enable debugging only when needed 2008-01-25 08:31:39 +01:00
resource.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
sections.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
serial.h avr32: add include/asm-avr32/serial.h 2008-04-19 20:40:10 -04:00
setup.h remove __attribute_used__ 2008-01-28 23:21:18 +01:00
shmbuf.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
shmparam.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
sigcontext.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
siginfo.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
signal.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
socket.h [NET]: Introducing socket mark socket option. 2008-01-31 19:27:19 -08:00
sockios.h [NET]: Introduce SIOCGSTAMPNS ioctl to get timestamps with nanosec resolution 2007-04-25 22:24:04 -07:00
stat.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
statfs.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
string.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
sysreg.h [AVR32] Implement irqflags trace and lockdep support 2007-12-07 14:52:37 +01:00
system.h Add cmpxchg_local to avr32 2008-02-07 08:42:31 -08:00
termbits.h lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
termios.h [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
thread_info.h [AVR32] Enable debugging only when needed 2008-01-25 08:31:39 +01:00
timex.h read_current_timer() cleanups 2008-02-06 10:41:02 -08:00
tlb.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
traps.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
types.h remove strict ansi check from __u64 in asm/types.h 2007-10-17 08:42:53 -07:00
uaccess.h [AVR32] Fix compile error with gcc 4.1 2007-04-27 14:21:47 +02:00
ucontext.h [PATCH] avr32 architecture 2006-09-26 08:48:54 -07:00
unaligned.h [AVR32] Remove optimization of unaligned word loads 2007-07-18 20:45:51 +02:00
unistd.h Fix timerfd breakage on avr32 2008-02-05 14:37:15 -08:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00
xor.h add include/asm-avr32/xor.h 2008-04-19 20:40:09 -04:00