linux-stable/include/asm-cris
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-v10 ide: add struct ide_io_ports (take 3) 2008-04-27 15:38:32 +02:00
arch-v32 CRIS v32: Remove hwregs/timer_defs.h, it is now architecture specific. 2008-02-08 17:51:15 +01:00
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
atomic.h CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return. 2008-02-08 11:06:33 +01:00
auxvec.h
axisflashmap.h CRIS: Merge axisflashmap.h with Axis internal changes. 2008-02-08 11:06:24 +01:00
bitops.h cris: remove unused __dummy, CONST_ADDR and ADDR from bitops.h 2008-02-05 09:44:24 -08:00
bug.h CRIS: Include arch dependent bug.h. 2008-02-08 11:06:32 +01:00
bugs.h
byteorder.h Clean up exported headers on CRIS 2006-09-21 09:33:55 +01:00
cache.h
cacheflush.h [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
checksum.h cris build fixes: fix csum_tcpudp_magic() declaration 2007-11-14 18:45:44 -08:00
cputime.h
current.h
delay.h CRIS: Allow arch dependent delay to override common version. 2008-02-08 11:06:32 +01:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
div64.h
dma-mapping.h CRIS: Remove define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 2008-02-08 11:06:24 +01:00
dma.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
eshlibld.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ethernet.h cris build fixes: update eth_v10.c ethernet driver 2007-11-14 18:45:45 -08:00
etraxgpio.h CRIS: Make io_pwm_set_period members unsigned in etraxgpio.h 2008-02-08 11:08:07 +01:00
etraxi2c.h
fasttimer.h CRISv10 improve and bugfix fasttimer 2007-11-14 18:45:47 -08:00
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h
futex.h
hardirq.h cris build fixes: hardirq.h: include asm/irq.h 2007-11-14 18:45:45 -08:00
hw_irq.h [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
ide.h
io.h CRIS: Correct comment in io.h to describe reality of I/O space. 2008-02-08 11:06:32 +01:00
ioctl.h
ioctls.h etrax: enable arbitary speed setting on tty ports 2007-07-16 09:05:38 -07:00
ipcbuf.h
irq.h [PATCH] genirq: cleanup: turn ARCH_HAS_IRQ_PER_CPU into CONFIG_IRQ_PER_CPU 2006-06-29 10:26:23 -07:00
irq_regs.h softlockup: make asm/irq_regs.h available on every platform 2007-10-17 08:42:47 -07:00
Kbuild CRIS: Add missing headers to include/asm-cris Kbuild files. 2008-02-08 11:06:37 +01:00
kdebug.h move die notifier handling to common code 2007-05-08 11:15:04 -07:00
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
mman.h
mmu.h
mmu_context.h [PATCH] x86: PARAVIRT: add hooks to intercept mm creation and destruction 2007-05-02 19:27:14 +02:00
module.h
msgbuf.h
mutex.h
namei.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
pci.h PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
percpu.h
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08: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
resource.h
rs485.h
rtc.h CRIS v10: Cleanup rtc.h 2008-02-08 11:06:29 +01:00
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
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] irq-flags: CRIS: Use the new IRQF_ constants 2006-07-02 13:58:46 -07:00
smp.h CRIS: Update cpu_possible_map and raw_smp_processor_id in smp.h header. 2008-02-08 11:06:32 +01: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
spinlock.h
stat.h
statfs.h
string.h
sync_serial.h CRIS v32: Add SECOND_WORD_SYNC, used in sync_serial. 2008-02-08 11:06:23 +01:00
system.h Add cmpxchg_local to cris 2008-02-07 08:42:31 -08:00
termbits.h cris build fixes: add baud rate defines 2007-11-14 18:45:45 -08:00
termios.h etrax: enable arbitary speed setting on tty ports 2007-07-16 09:05:38 -07:00
thread_info.h cris build fixes: corrected and improved NMI and IRQ handling 2007-11-14 18:45:45 -08:00
timex.h
tlb.h CRIS tlb.h should include linux/pagemap.h 2007-11-14 18:45:47 -08:00
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
types.h remove strict ansi check from __u64 in asm/types.h 2007-10-17 08:42:53 -07:00
uaccess.h cris: correct usage of __user for copy to and from user space in lib/usercopy and uaccess.h 2008-03-04 16:35:16 -08:00
ucontext.h
unaligned.h
unistd.h cris: correct syscall numbers in unistd.h for timerfd_settime and timerfd_gettime 2008-03-04 16:35:16 -08:00
user.h Sanitize the type of struct user.u_ar0 2008-02-07 08:42:30 -08:00