WSL2-Linux-Kernel/include/asm-xtensa
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
..
platform-iss fix file specification in comments 2007-05-09 08:58:16 +02:00
variant-fsf [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
Kbuild Add empty Kbuild files for 'make headers_install' in remaining arches. 2006-06-18 12:58:53 +01:00
a.out.h aout: move STACK_TOP[_MAX] to asm/processor.h 2008-02-08 09:22:29 -08:00
asmmacro.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
atomic.h atomic.h: atomic_add_unless as inline. Remove system.h atomic.h circular dependency 2007-05-08 11:15:20 -07:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bitops.h forbid asm/bitops.h direct inclusion 2007-10-19 11:53:41 -07:00
bootparam.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
bug.h [PATCH] xtensa: fix irq and misc fixes 2006-12-10 09:55:39 -08:00
bugs.h [XTENSA] Remove extraneous include statement 2007-08-27 13:53:27 -07:00
byteorder.h [XTENSA] clean-up header files 2007-05-31 17:47:01 -07:00
cache.h [XTENSA] Add support for cache-aliasing 2007-08-27 13:54:16 -07:00
cacheasm.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
cacheflush.h [XTENSA] Fix cache flush macro for D$/I$ aliasing/non-aliasing 2008-02-13 17:43:26 -08:00
checksum.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
coprocessor.h [XTENSA] Exclude thread-global registers from the xtregs structures. 2008-02-13 17:43:00 -08:00
cpumask.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
cputime.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
current.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
delay.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
div64.h [XTENSA] Use generic 64-bit division 2007-05-31 17:46:09 -07:00
dma-mapping.h xtensa: dma-mapping.h is using linux/scatterlist.h functions, so include it 2007-10-24 13:28:40 +02:00
dma.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
elf.h [XTENSA] Allow debugger to modify the WINDOWBASE register. 2008-02-13 17:45:36 -08:00
emergency-restart.h [PATCH] Add emergency_restart() 2005-07-26 14:35:41 -07:00
errno.h [PATCH] xtensa: cleanups for errno and ipc. 2005-06-30 08:45:10 -07:00
fb.h fbdev: detect primary display device 2007-07-17 10:23:11 -07:00
fcntl.h Xtensa: use asm-generic/fcntl.h 2007-05-31 20:18:25 -07:00
futex.h [PATCH] xtensa: add asm/futex.h 2006-02-01 08:53:23 -08:00
hardirq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
highmem.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07: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 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
io.h [XTENSA] Add support for cache-aliasing 2007-08-27 13:54:16 -07:00
ioctl.h [PATCH] Generic ioctl.h 2006-01-10 08:01:34 -08:00
ioctls.h [patch 1/2] Xtensa: enable arbitary tty speed setting ioctls 2007-08-27 13:54:25 -07:00
ipcbuf.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
irq.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
irq_regs.h [PATCH] xtensa: fix irq and misc fixes 2006-12-10 09:55:39 -08:00
kdebug.h move die notifier handling to common code 2007-05-08 11:15:04 -07:00
kmap_types.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -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] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
local.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
mman.h [PATCH] Remove final references to deprecated "MAP_ANON" page protection flag 2007-02-11 10:51:17 -08:00
mmu.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
mmu_context.h [XTENSA] clean-up header files 2007-05-31 17:47:01 -07:00
module.h [XTENSA] Fix modules for non-exec processor configurations 2008-02-13 17:23:26 -08:00
msgbuf.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
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-bridge.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
pci.h PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
percpu.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
pgalloc.h [XTENSA] Fix non-existent pte_token_t typedef to pgtable_t 2008-02-13 16:25:09 -08:00
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
platform.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01: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 [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
ptrace.h [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
regs.h [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
resource.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
rmap.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
rwsem.h [PATCH] lockdep: remove RWSEM_DEBUG remnants 2006-07-03 15:27:01 -07:00
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
sections.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
segment.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h [PATCH] xtensa: remove extra header files 2006-12-10 09:55:39 -08:00
serial.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
setup.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
shmbuf.h [PATCH] xtensa: fix system call interface 2006-12-10 09:55:39 -08:00
shmparam.h [XTENSA] clean-up header files 2007-05-31 17:47:01 -07:00
sigcontext.h [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
siginfo.h fix file specification in comments 2006-10-03 23:01:26 +02:00
signal.h [PATCH] irq-flags: XTENSA: Use the new IRQF_ constants 2006-07-02 13:58:49 -07:00
smp.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -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
spinlock.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
stat.h [XTENSA] Clean up stat structs. 2008-02-13 17:27:03 -08:00
statfs.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
string.h [PATCH] xtensa: replace 'extern inline' with 'static inline' 2005-09-05 00:06:25 -07:00
syscall.h [XTENSA] Fix fadvise64_64 2007-08-27 13:53:32 -07:00
system.h [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
termbits.h [patch 1/2] Xtensa: enable arbitary tty speed setting ioctls 2007-08-27 13:54:25 -07:00
termios.h [patch 1/2] Xtensa: enable arbitary tty speed setting ioctls 2007-08-27 13:54:25 -07:00
thread_info.h [XTENSA] Add support for configurable registers and coprocessors 2008-02-13 17:41:43 -08:00
timex.h [XTENSA] Add volatile keyword to asm statements accessing counter registers 2008-02-13 17:24:47 -08:00
tlb.h add mm argument to pte/pmd/pud/pgd_free 2008-02-05 09:44:18 -08:00
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
types.h remove strict ansi check from __u64 in asm/types.h 2007-10-17 08:42:53 -07:00
uaccess.h [XTENSA] Fix clobbered register in asm macro 2008-02-13 17:06:41 -08:00
ucontext.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
unaligned.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
unistd.h fix xtensa timerfd breakage 2008-02-08 15:33:32 -08:00
user.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
xor.h [PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6 2005-06-24 00:05:22 -07:00