aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-12-12 12:14:57 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:27:08 -0500
commitec8c0446b6e2b67b5c8813eb517f4bf00efa99a9 (patch)
treee7c12d7c486c958a5e38888b41cfcd6a558f1aff
parentbcd022801ee514e28c32837f0b3ce18c775f1a7b (diff)
[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: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/cachetlb.txt23
-rw-r--r--include/asm-alpha/cacheflush.h1
-rw-r--r--include/asm-arm/cacheflush.h2
-rw-r--r--include/asm-arm26/cacheflush.h1
-rw-r--r--include/asm-avr32/cacheflush.h1
-rw-r--r--include/asm-cris/cacheflush.h1
-rw-r--r--include/asm-frv/cacheflush.h1
-rw-r--r--include/asm-h8300/cacheflush.h1
-rw-r--r--include/asm-i386/cacheflush.h1
-rw-r--r--include/asm-ia64/cacheflush.h1
-rw-r--r--include/asm-m32r/cacheflush.h3
-rw-r--r--include/asm-m68k/cacheflush.h2
-rw-r--r--include/asm-m68knommu/cacheflush.h1
-rw-r--r--include/asm-mips/cacheflush.h2
-rw-r--r--include/asm-parisc/cacheflush.h2
-rw-r--r--include/asm-powerpc/cacheflush.h1
-rw-r--r--include/asm-s390/cacheflush.h1
-rw-r--r--include/asm-sh/cpu-sh2/cacheflush.h2
-rw-r--r--include/asm-sh/cpu-sh3/cacheflush.h3
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h1
-rw-r--r--include/asm-sh64/cacheflush.h2
-rw-r--r--include/asm-sparc/cacheflush.h1
-rw-r--r--include/asm-sparc64/cacheflush.h1
-rw-r--r--include/asm-v850/cacheflush.h1
-rw-r--r--include/asm-x86_64/cacheflush.h1
-rw-r--r--include/asm-xtensa/cacheflush.h2
-rw-r--r--kernel/fork.c2
27 files changed, 54 insertions, 7 deletions
diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
index 53245c429f7d..73e794f0ff09 100644
--- a/Documentation/cachetlb.txt
+++ b/Documentation/cachetlb.txt
@@ -179,10 +179,21 @@ Here are the routines, one by one:
179 lines associated with 'mm'. 179 lines associated with 'mm'.
180 180
181 This interface is used to handle whole address space 181 This interface is used to handle whole address space
182 page table operations such as what happens during 182 page table operations such as what happens during exit and exec.
183 fork, exit, and exec. 183
1842) void flush_cache_dup_mm(struct mm_struct *mm)
185
186 This interface flushes an entire user address space from
187 the caches. That is, after running, there will be no cache
188 lines associated with 'mm'.
189
190 This interface is used to handle whole address space
191 page table operations such as what happens during fork.
192
193 This option is separate from flush_cache_mm to allow some
194 optimizations for VIPT caches.
184 195
1852) void flush_cache_range(struct vm_area_struct *vma, 1963) void flush_cache_range(struct vm_area_struct *vma,
186 unsigned long start, unsigned long end) 197 unsigned long start, unsigned long end)
187 198
188 Here we are flushing a specific range of (user) virtual 199 Here we are flushing a specific range of (user) virtual
@@ -199,7 +210,7 @@ Here are the routines, one by one:
199 call flush_cache_page (see below) for each entry which may be 210 call flush_cache_page (see below) for each entry which may be
200 modified. 211 modified.
201 212
2023) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn) 2134) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
203 214
204 This time we need to remove a PAGE_SIZE sized range 215 This time we need to remove a PAGE_SIZE sized range
205 from the cache. The 'vma' is the backing structure used by 216 from the cache. The 'vma' is the backing structure used by
@@ -220,7 +231,7 @@ Here are the routines, one by one:
220 231
221 This is used primarily during fault processing. 232 This is used primarily during fault processing.
222 233
2234) void flush_cache_kmaps(void) 2345) void flush_cache_kmaps(void)
224 235
225 This routine need only be implemented if the platform utilizes 236 This routine need only be implemented if the platform utilizes
226 highmem. It will be called right before all of the kmaps 237 highmem. It will be called right before all of the kmaps
@@ -232,7 +243,7 @@ Here are the routines, one by one:
232 243
233 This routing should be implemented in asm/highmem.h 244 This routing should be implemented in asm/highmem.h
234 245
2355) void flush_cache_vmap(unsigned long start, unsigned long end) 2466) void flush_cache_vmap(unsigned long start, unsigned long end)
236 void flush_cache_vunmap(unsigned long start, unsigned long end) 247 void flush_cache_vunmap(unsigned long start, unsigned long end)
237 248
238 Here in these two interfaces we are flushing a specific range 249 Here in these two interfaces we are flushing a specific range
diff --git a/include/asm-alpha/cacheflush.h b/include/asm-alpha/cacheflush.h
index 805640b41078..b686cc7fc44e 100644
--- a/include/asm-alpha/cacheflush.h
+++ b/include/asm-alpha/cacheflush.h
@@ -6,6 +6,7 @@
6/* Caches aren't brain-dead on the Alpha. */ 6/* Caches aren't brain-dead on the Alpha. */
7#define flush_cache_all() do { } while (0) 7#define flush_cache_all() do { } while (0)
8#define flush_cache_mm(mm) do { } while (0) 8#define flush_cache_mm(mm) do { } while (0)
9#define flush_cache_dup_mm(mm) do { } while (0)
9#define flush_cache_range(vma, start, end) do { } while (0) 10#define flush_cache_range(vma, start, end) do { } while (0)
10#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 11#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
11#define flush_dcache_page(page) do { } while (0) 12#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index f0845646aacb..378a3a2ce8d9 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -319,6 +319,8 @@ extern void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
319 unsigned long len, int write); 319 unsigned long len, int write);
320#endif 320#endif
321 321
322#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
323
322/* 324/*
323 * flush_cache_user_range is used when we want to ensure that the 325 * flush_cache_user_range is used when we want to ensure that the
324 * Harvard caches are synchronised for the user space address range. 326 * Harvard caches are synchronised for the user space address range.
diff --git a/include/asm-arm26/cacheflush.h b/include/asm-arm26/cacheflush.h
index 9c1b9c7f2ebd..14ae15b6faab 100644
--- a/include/asm-arm26/cacheflush.h
+++ b/include/asm-arm26/cacheflush.h
@@ -22,6 +22,7 @@
22 22
23#define flush_cache_all() do { } while (0) 23#define flush_cache_all() do { } while (0)
24#define flush_cache_mm(mm) do { } while (0) 24#define flush_cache_mm(mm) do { } while (0)
25#define flush_cache_dup_mm(mm) do { } while (0)
25#define flush_cache_range(vma,start,end) do { } while (0) 26#define flush_cache_range(vma,start,end) do { } while (0)
26#define flush_cache_page(vma,vmaddr,pfn) do { } while (0) 27#define flush_cache_page(vma,vmaddr,pfn) do { } while (0)
27#define flush_cache_vmap(start, end) do { } while (0) 28#define flush_cache_vmap(start, end) do { } while (0)
diff --git a/include/asm-avr32/cacheflush.h b/include/asm-avr32/cacheflush.h
index f1bf1708980e..dfaaa88cd412 100644
--- a/include/asm-avr32/cacheflush.h
+++ b/include/asm-avr32/cacheflush.h
@@ -87,6 +87,7 @@ void invalidate_icache_region(void *start, size_t len);
87 */ 87 */
88#define flush_cache_all() do { } while (0) 88#define flush_cache_all() do { } while (0)
89#define flush_cache_mm(mm) do { } while (0) 89#define flush_cache_mm(mm) do { } while (0)
90#define flush_cache_dup_mm(mm) do { } while (0)
90#define flush_cache_range(vma, start, end) do { } while (0) 91#define flush_cache_range(vma, start, end) do { } while (0)
91#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 92#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
92#define flush_cache_vmap(start, end) do { } while (0) 93#define flush_cache_vmap(start, end) do { } while (0)
diff --git a/include/asm-cris/cacheflush.h b/include/asm-cris/cacheflush.h
index 72cc71dffe70..01af2de27c5b 100644
--- a/include/asm-cris/cacheflush.h
+++ b/include/asm-cris/cacheflush.h
@@ -9,6 +9,7 @@
9 */ 9 */
10#define flush_cache_all() do { } while (0) 10#define flush_cache_all() do { } while (0)
11#define flush_cache_mm(mm) do { } while (0) 11#define flush_cache_mm(mm) do { } while (0)
12#define flush_cache_dup_mm(mm) do { } while (0)
12#define flush_cache_range(vma, start, end) do { } while (0) 13#define flush_cache_range(vma, start, end) do { } while (0)
13#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 14#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
14#define flush_dcache_page(page) do { } while (0) 15#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h
index eaa5826bc1c8..02500405a6fb 100644
--- a/include/asm-frv/cacheflush.h
+++ b/include/asm-frv/cacheflush.h
@@ -20,6 +20,7 @@
20 */ 20 */
21#define flush_cache_all() do {} while(0) 21#define flush_cache_all() do {} while(0)
22#define flush_cache_mm(mm) do {} while(0) 22#define flush_cache_mm(mm) do {} while(0)
23#define flush_cache_dup_mm(mm) do {} while(0)
23#define flush_cache_range(mm, start, end) do {} while(0) 24#define flush_cache_range(mm, start, end) do {} while(0)
24#define flush_cache_page(vma, vmaddr, pfn) do {} while(0) 25#define flush_cache_page(vma, vmaddr, pfn) do {} while(0)
25#define flush_cache_vmap(start, end) do {} while(0) 26#define flush_cache_vmap(start, end) do {} while(0)
diff --git a/include/asm-h8300/cacheflush.h b/include/asm-h8300/cacheflush.h
index 1e4d95bb5ec9..71210d141b64 100644
--- a/include/asm-h8300/cacheflush.h
+++ b/include/asm-h8300/cacheflush.h
@@ -12,6 +12,7 @@
12 12
13#define flush_cache_all() 13#define flush_cache_all()
14#define flush_cache_mm(mm) 14#define flush_cache_mm(mm)
15#define flush_cache_dup_mm(mm) do { } while (0)
15#define flush_cache_range(vma,a,b) 16#define flush_cache_range(vma,a,b)
16#define flush_cache_page(vma,p,pfn) 17#define flush_cache_page(vma,p,pfn)
17#define flush_dcache_page(page) 18#define flush_dcache_page(page)
diff --git a/include/asm-i386/cacheflush.h b/include/asm-i386/cacheflush.h
index 7199f7b326f1..74e03c8f2e51 100644
--- a/include/asm-i386/cacheflush.h
+++ b/include/asm-i386/cacheflush.h
@@ -7,6 +7,7 @@
7/* Caches aren't brain-dead on the intel. */ 7/* Caches aren't brain-dead on the intel. */
8#define flush_cache_all() do { } while (0) 8#define flush_cache_all() do { } while (0)
9#define flush_cache_mm(mm) do { } while (0) 9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
10#define flush_cache_range(vma, start, end) do { } while (0) 11#define flush_cache_range(vma, start, end) do { } while (0)
11#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
12#define flush_dcache_page(page) do { } while (0) 13#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-ia64/cacheflush.h b/include/asm-ia64/cacheflush.h
index f2dacb4245ec..4906916d715b 100644
--- a/include/asm-ia64/cacheflush.h
+++ b/include/asm-ia64/cacheflush.h
@@ -18,6 +18,7 @@
18 18
19#define flush_cache_all() do { } while (0) 19#define flush_cache_all() do { } while (0)
20#define flush_cache_mm(mm) do { } while (0) 20#define flush_cache_mm(mm) do { } while (0)
21#define flush_cache_dup_mm(mm) do { } while (0)
21#define flush_cache_range(vma, start, end) do { } while (0) 22#define flush_cache_range(vma, start, end) do { } while (0)
22#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 23#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
23#define flush_icache_page(vma,page) do { } while (0) 24#define flush_icache_page(vma,page) do { } while (0)
diff --git a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
index 8b261b49149e..56961a9511b2 100644
--- a/include/asm-m32r/cacheflush.h
+++ b/include/asm-m32r/cacheflush.h
@@ -9,6 +9,7 @@ extern void _flush_cache_copyback_all(void);
9#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) 9#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
10#define flush_cache_all() do { } while (0) 10#define flush_cache_all() do { } while (0)
11#define flush_cache_mm(mm) do { } while (0) 11#define flush_cache_mm(mm) do { } while (0)
12#define flush_cache_dup_mm(mm) do { } while (0)
12#define flush_cache_range(vma, start, end) do { } while (0) 13#define flush_cache_range(vma, start, end) do { } while (0)
13#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 14#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
14#define flush_dcache_page(page) do { } while (0) 15#define flush_dcache_page(page) do { } while (0)
@@ -29,6 +30,7 @@ extern void smp_flush_cache_all(void);
29#elif defined(CONFIG_CHIP_M32102) 30#elif defined(CONFIG_CHIP_M32102)
30#define flush_cache_all() do { } while (0) 31#define flush_cache_all() do { } while (0)
31#define flush_cache_mm(mm) do { } while (0) 32#define flush_cache_mm(mm) do { } while (0)
33#define flush_cache_dup_mm(mm) do { } while (0)
32#define flush_cache_range(vma, start, end) do { } while (0) 34#define flush_cache_range(vma, start, end) do { } while (0)
33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 35#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
34#define flush_dcache_page(page) do { } while (0) 36#define flush_dcache_page(page) do { } while (0)
@@ -41,6 +43,7 @@ extern void smp_flush_cache_all(void);
41#else 43#else
42#define flush_cache_all() do { } while (0) 44#define flush_cache_all() do { } while (0)
43#define flush_cache_mm(mm) do { } while (0) 45#define flush_cache_mm(mm) do { } while (0)
46#define flush_cache_dup_mm(mm) do { } while (0)
44#define flush_cache_range(vma, start, end) do { } while (0) 47#define flush_cache_range(vma, start, end) do { } while (0)
45#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 48#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
46#define flush_dcache_page(page) do { } while (0) 49#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
index 24d3ff449135..16bf375fdbe1 100644
--- a/include/asm-m68k/cacheflush.h
+++ b/include/asm-m68k/cacheflush.h
@@ -89,6 +89,8 @@ static inline void flush_cache_mm(struct mm_struct *mm)
89 __flush_cache_030(); 89 __flush_cache_030();
90} 90}
91 91
92#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
93
92/* flush_cache_range/flush_cache_page must be macros to avoid 94/* flush_cache_range/flush_cache_page must be macros to avoid
93 a dependency on linux/mm.h, which includes this file... */ 95 a dependency on linux/mm.h, which includes this file... */
94static inline void flush_cache_range(struct vm_area_struct *vma, 96static inline void flush_cache_range(struct vm_area_struct *vma,
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index c3aadf3b0d88..163dcb1a9689 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -8,6 +8,7 @@
8 8
9#define flush_cache_all() __flush_cache_all() 9#define flush_cache_all() __flush_cache_all()
10#define flush_cache_mm(mm) do { } while (0) 10#define flush_cache_mm(mm) do { } while (0)
11#define flush_cache_dup_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) __flush_cache_all() 12#define flush_cache_range(vma, start, end) __flush_cache_all()
12#define flush_cache_page(vma, vmaddr) do { } while (0) 13#define flush_cache_page(vma, vmaddr) do { } while (0)
13#define flush_dcache_range(start,len) __flush_cache_all() 14#define flush_dcache_range(start,len) __flush_cache_all()
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index e3c9925876a3..0ddada3bb0b6 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -17,6 +17,7 @@
17 * 17 *
18 * - flush_cache_all() flushes entire cache 18 * - flush_cache_all() flushes entire cache
19 * - flush_cache_mm(mm) flushes the specified mm context's cache lines 19 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
20 * - flush_cache_dup mm(mm) handles cache flushing when forking
20 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page 21 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
21 * - flush_cache_range(vma, start, end) flushes a range of pages 22 * - flush_cache_range(vma, start, end) flushes a range of pages
22 * - flush_icache_range(start, end) flush a range of instructions 23 * - flush_icache_range(start, end) flush a range of instructions
@@ -31,6 +32,7 @@
31extern void (*flush_cache_all)(void); 32extern void (*flush_cache_all)(void);
32extern void (*__flush_cache_all)(void); 33extern void (*__flush_cache_all)(void);
33extern void (*flush_cache_mm)(struct mm_struct *mm); 34extern void (*flush_cache_mm)(struct mm_struct *mm);
35#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0)
34extern void (*flush_cache_range)(struct vm_area_struct *vma, 36extern void (*flush_cache_range)(struct vm_area_struct *vma,
35 unsigned long start, unsigned long end); 37 unsigned long start, unsigned long end);
36extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn); 38extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index 2bc41f2e0271..aedb0512cb04 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -15,6 +15,8 @@
15#define flush_cache_mm(mm) flush_cache_all_local() 15#define flush_cache_mm(mm) flush_cache_all_local()
16#endif 16#endif
17 17
18#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
19
18#define flush_kernel_dcache_range(start,size) \ 20#define flush_kernel_dcache_range(start,size) \
19 flush_kernel_dcache_range_asm((start), (start)+(size)); 21 flush_kernel_dcache_range_asm((start), (start)+(size));
20 22
diff --git a/include/asm-powerpc/cacheflush.h b/include/asm-powerpc/cacheflush.h
index 8a740c88d93d..08e93e789219 100644
--- a/include/asm-powerpc/cacheflush.h
+++ b/include/asm-powerpc/cacheflush.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#define flush_cache_all() do { } while (0) 19#define flush_cache_all() do { } while (0)
20#define flush_cache_mm(mm) do { } while (0) 20#define flush_cache_mm(mm) do { } while (0)
21#define flush_cache_dup_mm(mm) do { } while (0)
21#define flush_cache_range(vma, start, end) do { } while (0) 22#define flush_cache_range(vma, start, end) do { } while (0)
22#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 23#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
23#define flush_icache_page(vma, page) do { } while (0) 24#define flush_icache_page(vma, page) do { } while (0)
diff --git a/include/asm-s390/cacheflush.h b/include/asm-s390/cacheflush.h
index e399a8ba2ed7..f7cade8083f3 100644
--- a/include/asm-s390/cacheflush.h
+++ b/include/asm-s390/cacheflush.h
@@ -7,6 +7,7 @@
7/* Caches aren't brain-dead on the s390. */ 7/* Caches aren't brain-dead on the s390. */
8#define flush_cache_all() do { } while (0) 8#define flush_cache_all() do { } while (0)
9#define flush_cache_mm(mm) do { } while (0) 9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
10#define flush_cache_range(vma, start, end) do { } while (0) 11#define flush_cache_range(vma, start, end) do { } while (0)
11#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
12#define flush_dcache_page(page) do { } while (0) 13#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-sh/cpu-sh2/cacheflush.h b/include/asm-sh/cpu-sh2/cacheflush.h
index f556fa80ea97..2979efb26de3 100644
--- a/include/asm-sh/cpu-sh2/cacheflush.h
+++ b/include/asm-sh/cpu-sh2/cacheflush.h
@@ -15,6 +15,7 @@
15 * 15 *
16 * - flush_cache_all() flushes entire cache 16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines 17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
18 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page 19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
19 * - flush_cache_range(vma, start, end) flushes a range of pages 20 * - flush_cache_range(vma, start, end) flushes a range of pages
20 * 21 *
@@ -27,6 +28,7 @@
27 */ 28 */
28#define flush_cache_all() do { } while (0) 29#define flush_cache_all() do { } while (0)
29#define flush_cache_mm(mm) do { } while (0) 30#define flush_cache_mm(mm) do { } while (0)
31#define flush_cache_dup_mm(mm) do { } while (0)
30#define flush_cache_range(vma, start, end) do { } while (0) 32#define flush_cache_range(vma, start, end) do { } while (0)
31#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
32#define flush_dcache_page(page) do { } while (0) 34#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
index 03fde97a7fd0..f70d8ef76a15 100644
--- a/include/asm-sh/cpu-sh3/cacheflush.h
+++ b/include/asm-sh/cpu-sh3/cacheflush.h
@@ -15,6 +15,7 @@
15 * 15 *
16 * - flush_cache_all() flushes entire cache 16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines 17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
18 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page 19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
19 * - flush_cache_range(vma, start, end) flushes a range of pages 20 * - flush_cache_range(vma, start, end) flushes a range of pages
20 * 21 *
@@ -39,6 +40,7 @@
39 40
40void flush_cache_all(void); 41void flush_cache_all(void);
41void flush_cache_mm(struct mm_struct *mm); 42void flush_cache_mm(struct mm_struct *mm);
43#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
42void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 44void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
43 unsigned long end); 45 unsigned long end);
44void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); 46void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
@@ -48,6 +50,7 @@ void flush_icache_page(struct vm_area_struct *vma, struct page *page);
48#else 50#else
49#define flush_cache_all() do { } while (0) 51#define flush_cache_all() do { } while (0)
50#define flush_cache_mm(mm) do { } while (0) 52#define flush_cache_mm(mm) do { } while (0)
53#define flush_cache_dup_mm(mm) do { } while (0)
51#define flush_cache_range(vma, start, end) do { } while (0) 54#define flush_cache_range(vma, start, end) do { } while (0)
52#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 55#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
53#define flush_dcache_page(page) do { } while (0) 56#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
index 515fd574267c..b01a10f31225 100644
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ b/include/asm-sh/cpu-sh4/cacheflush.h
@@ -18,6 +18,7 @@
18 */ 18 */
19void flush_cache_all(void); 19void flush_cache_all(void);
20void flush_cache_mm(struct mm_struct *mm); 20void flush_cache_mm(struct mm_struct *mm);
21#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
21void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 22void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
22 unsigned long end); 23 unsigned long end);
23void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, 24void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
diff --git a/include/asm-sh64/cacheflush.h b/include/asm-sh64/cacheflush.h
index 55f71aa0aa6b..1e53a47bdc97 100644
--- a/include/asm-sh64/cacheflush.h
+++ b/include/asm-sh64/cacheflush.h
@@ -21,6 +21,8 @@ extern void flush_icache_user_range(struct vm_area_struct *vma,
21 struct page *page, unsigned long addr, 21 struct page *page, unsigned long addr,
22 int len); 22 int len);
23 23
24#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
25
24#define flush_dcache_mmap_lock(mapping) do { } while (0) 26#define flush_dcache_mmap_lock(mapping) do { } while (0)
25#define flush_dcache_mmap_unlock(mapping) do { } while (0) 27#define flush_dcache_mmap_unlock(mapping) do { } while (0)
26 28
diff --git a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h
index fc632f811cd8..68ac10910271 100644
--- a/include/asm-sparc/cacheflush.h
+++ b/include/asm-sparc/cacheflush.h
@@ -48,6 +48,7 @@ BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)
48 48
49#define flush_cache_all() BTFIXUP_CALL(flush_cache_all)() 49#define flush_cache_all() BTFIXUP_CALL(flush_cache_all)()
50#define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm) 50#define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
51#define flush_cache_dup_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
51#define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end) 52#define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end)
52#define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr) 53#define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr)
53#define flush_icache_range(start, end) do { } while (0) 54#define flush_icache_range(start, end) do { } while (0)
diff --git a/include/asm-sparc64/cacheflush.h b/include/asm-sparc64/cacheflush.h
index 745d1ab60371..122e4058dd9e 100644
--- a/include/asm-sparc64/cacheflush.h
+++ b/include/asm-sparc64/cacheflush.h
@@ -12,6 +12,7 @@
12/* These are the same regardless of whether this is an SMP kernel or not. */ 12/* These are the same regardless of whether this is an SMP kernel or not. */
13#define flush_cache_mm(__mm) \ 13#define flush_cache_mm(__mm) \
14 do { if ((__mm) == current->mm) flushw_user(); } while(0) 14 do { if ((__mm) == current->mm) flushw_user(); } while(0)
15#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
15#define flush_cache_range(vma, start, end) \ 16#define flush_cache_range(vma, start, end) \
16 flush_cache_mm((vma)->vm_mm) 17 flush_cache_mm((vma)->vm_mm)
17#define flush_cache_page(vma, page, pfn) \ 18#define flush_cache_page(vma, page, pfn) \
diff --git a/include/asm-v850/cacheflush.h b/include/asm-v850/cacheflush.h
index e1a87f82f1a4..9ece05a202ef 100644
--- a/include/asm-v850/cacheflush.h
+++ b/include/asm-v850/cacheflush.h
@@ -24,6 +24,7 @@
24 systems with MMUs, so we don't need them. */ 24 systems with MMUs, so we don't need them. */
25#define flush_cache_all() ((void)0) 25#define flush_cache_all() ((void)0)
26#define flush_cache_mm(mm) ((void)0) 26#define flush_cache_mm(mm) ((void)0)
27#define flush_cache_dup_mm(mm) ((void)0)
27#define flush_cache_range(vma, start, end) ((void)0) 28#define flush_cache_range(vma, start, end) ((void)0)
28#define flush_cache_page(vma, vmaddr, pfn) ((void)0) 29#define flush_cache_page(vma, vmaddr, pfn) ((void)0)
29#define flush_dcache_page(page) ((void)0) 30#define flush_dcache_page(page) ((void)0)
diff --git a/include/asm-x86_64/cacheflush.h b/include/asm-x86_64/cacheflush.h
index d32f7f58752a..ab1cb5c7dc92 100644
--- a/include/asm-x86_64/cacheflush.h
+++ b/include/asm-x86_64/cacheflush.h
@@ -7,6 +7,7 @@
7/* Caches aren't brain-dead on the intel. */ 7/* Caches aren't brain-dead on the intel. */
8#define flush_cache_all() do { } while (0) 8#define flush_cache_all() do { } while (0)
9#define flush_cache_mm(mm) do { } while (0) 9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
10#define flush_cache_range(vma, start, end) do { } while (0) 11#define flush_cache_range(vma, start, end) do { } while (0)
11#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
12#define flush_dcache_page(page) do { } while (0) 13#define flush_dcache_page(page) do { } while (0)
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h
index 337765b629de..22ef901b7845 100644
--- a/include/asm-xtensa/cacheflush.h
+++ b/include/asm-xtensa/cacheflush.h
@@ -75,6 +75,7 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
75 75
76#define flush_cache_all() __flush_invalidate_cache_all(); 76#define flush_cache_all() __flush_invalidate_cache_all();
77#define flush_cache_mm(mm) __flush_invalidate_cache_all(); 77#define flush_cache_mm(mm) __flush_invalidate_cache_all();
78#define flush_cache_dup_mm(mm) __flush_invalidate_cache_all();
78 79
79#define flush_cache_vmap(start,end) __flush_invalidate_cache_all(); 80#define flush_cache_vmap(start,end) __flush_invalidate_cache_all();
80#define flush_cache_vunmap(start,end) __flush_invalidate_cache_all(); 81#define flush_cache_vunmap(start,end) __flush_invalidate_cache_all();
@@ -88,6 +89,7 @@ extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned lon
88 89
89#define flush_cache_all() do { } while (0) 90#define flush_cache_all() do { } while (0)
90#define flush_cache_mm(mm) do { } while (0) 91#define flush_cache_mm(mm) do { } while (0)
92#define flush_cache_dup_mm(mm) do { } while (0)
91 93
92#define flush_cache_vmap(start,end) do { } while (0) 94#define flush_cache_vmap(start,end) do { } while (0)
93#define flush_cache_vunmap(start,end) do { } while (0) 95#define flush_cache_vunmap(start,end) do { } while (0)
diff --git a/kernel/fork.c b/kernel/fork.c
index d16c566eb645..fc723e595cd5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -203,7 +203,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
203 struct mempolicy *pol; 203 struct mempolicy *pol;
204 204
205 down_write(&oldmm->mmap_sem); 205 down_write(&oldmm->mmap_sem);
206 flush_cache_mm(oldmm); 206 flush_cache_dup_mm(oldmm);
207 /* 207 /*
208 * Not linked in yet - no deadlock potential: 208 * Not linked in yet - no deadlock potential:
209 */ 209 */