Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec8c0446 authored by Ralf Baechle's avatar Ralf Baechle Committed by Linus Torvalds
Browse files

[PATCH] Optimize D-cache alias handling on fork



Virtually index, physically tagged cache architectures can get away
without cache flushing when forking.  This patch adds a new cache
flushing function flush_cache_dup_mm(struct mm_struct *) which for the
moment I've implemented to do the same thing on all architectures
except on MIPS where it's a no-op.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bcd02280
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -179,10 +179,21 @@ Here are the routines, one by one:
	lines associated with 'mm'.

	This interface is used to handle whole address space
	page table operations such as what happens during
	fork, exit, and exec.
	page table operations such as what happens during exit and exec.

2) void flush_cache_dup_mm(struct mm_struct *mm)

	This interface flushes an entire user address space from
	the caches.  That is, after running, there will be no cache
	lines associated with 'mm'.

	This interface is used to handle whole address space
	page table operations such as what happens during fork.

	This option is separate from flush_cache_mm to allow some
	optimizations for VIPT caches.

2) void flush_cache_range(struct vm_area_struct *vma,
3) void flush_cache_range(struct vm_area_struct *vma,
			  unsigned long start, unsigned long end)

	Here we are flushing a specific range of (user) virtual
@@ -199,7 +210,7 @@ Here are the routines, one by one:
	call flush_cache_page (see below) for each entry which may be
	modified.

3) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
4) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)

	This time we need to remove a PAGE_SIZE sized range
	from the cache.  The 'vma' is the backing structure used by
@@ -220,7 +231,7 @@ Here are the routines, one by one:

	This is used primarily during fault processing.

4) void flush_cache_kmaps(void)
5) void flush_cache_kmaps(void)

	This routine need only be implemented if the platform utilizes
	highmem.  It will be called right before all of the kmaps
@@ -232,7 +243,7 @@ Here are the routines, one by one:

	This routing should be implemented in asm/highmem.h

5) void flush_cache_vmap(unsigned long start, unsigned long end)
6) void flush_cache_vmap(unsigned long start, unsigned long end)
   void flush_cache_vunmap(unsigned long start, unsigned long end)

	Here in these two interfaces we are flushing a specific range
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
/* Caches aren't brain-dead on the Alpha. */
#define flush_cache_all()			do { } while (0)
#define flush_cache_mm(mm)			do { } while (0)
#define flush_cache_dup_mm(mm)			do { } while (0)
#define flush_cache_range(vma, start, end)	do { } while (0)
#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
#define flush_dcache_page(page)			do { } while (0)
+2 −0
Original line number Diff line number Diff line
@@ -319,6 +319,8 @@ extern void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
				unsigned long len, int write);
#endif

#define flush_cache_dup_mm(mm) flush_cache_mm(mm)

/*
 * flush_cache_user_range is used when we want to ensure that the
 * Harvard caches are synchronised for the user space address range.
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#define flush_cache_all()                       do { } while (0)
#define flush_cache_mm(mm)                      do { } while (0)
#define flush_cache_dup_mm(mm)                  do { } while (0)
#define flush_cache_range(vma,start,end)        do { } while (0)
#define flush_cache_page(vma,vmaddr,pfn)        do { } while (0)
#define flush_cache_vmap(start, end)		do { } while (0)
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ void invalidate_icache_region(void *start, size_t len);
 */
#define flush_cache_all()			do { } while (0)
#define flush_cache_mm(mm)			do { } while (0)
#define flush_cache_dup_mm(mm)			do { } while (0)
#define flush_cache_range(vma, start, end)	do { } while (0)
#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
#define flush_cache_vmap(start, end)		do { } while (0)
Loading