[parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb

James Bottomley James.Bottomley at steeleye.com
Wed Apr 14 11:53:23 MDT 2004


On Wed, 2004-04-14 at 12:45, James Bottomley wrote:
> CVSROOT:	/var/cvs
> Module name:	linux-2.6
> Changes by:	jejb	04/04/14 11:45:35
> 
> Modified files:
> 	.              : Makefile 
> 	arch/parisc/kernel: cache.c sys_parisc.c 
> 
> Log message:
> Make all shared mappings and all file mappings (including MAP_PRIVATE)
> equivalently mapped.
> 
> This allows us only to flush a single space again in flush_dcache_page().
> 
> The flip side is that now all shared libraries are going to be mapped
> on 4MB boundaries.  This only wastes virtual space, but it may run us
> out of mappings faster than would otherwise happen in ILP32 processes.

Index: arch/parisc/kernel/cache.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/cache.c,v
retrieving revision 1.9
diff -u -r1.9 cache.c
--- a/arch/parisc/kernel/cache.c	12 Apr 2004 15:48:00 -0000	1.9
+++ b/arch/parisc/kernel/cache.c	14 Apr 2004 17:42:54 -0000
@@ -265,12 +265,16 @@
 
 		__flush_cache_page(mpnt, addr);
 
-		break;
+		/* If we find an address to flush, that will also
+		 * bring all the private mappings up to date (see
+		 * comment below) */
+		return;
 	}
 
-	/* Private mappings will not have congruent addresses, so we
-	 * have to flush each of them individually to make the change
-	 * in the kernel page visible */
+	/* we have carefully arranged in arch_get_unmapped_area() that
+	 * *any* mappings of a file are always congruently mapped (whether
+	 * declared as MAP_PRIVATE or MAP_SHARED), so we only need
+	 * to flush one address here too */
 	list_for_each(l, &page->mapping->i_mmap) {
 		struct vm_area_struct *mpnt;
 		unsigned long off, addr;
@@ -293,6 +297,8 @@
 			continue;
 
 		__flush_cache_page(mpnt, addr);
+
+		return;
 	}
 }
 EXPORT_SYMBOL(__flush_dcache_page);
Index: arch/parisc/kernel/sys_parisc.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/sys_parisc.c,v
retrieving revision 1.21
diff -u -r1.21 sys_parisc.c
--- a/arch/parisc/kernel/sys_parisc.c	16 Mar 2004 15:39:55 -0000	1.21
+++ b/arch/parisc/kernel/sys_parisc.c	14 Apr 2004 17:42:54 -0000
@@ -93,7 +93,7 @@
 		unsigned long addr, unsigned long len, unsigned long pgoff)
 {
 	struct vm_area_struct *vma;
-	int offset = get_offset(mapping);
+	int offset = mapping ? get_offset(mapping) : 0;
 
 	addr = DCACHE_ALIGN(addr - offset) + offset;
 
@@ -117,8 +117,10 @@
 	if (!addr)
 		addr = TASK_UNMAPPED_BASE;
 
-	if (filp && (flags & MAP_SHARED)) {
+	if (filp) {
 		addr = get_shared_area(filp->f_mapping, addr, len, pgoff);
+	} else if(flags & MAP_SHARED) {
+		addr = get_shared_area(NULL, addr, len, pgoff);
 	} else {
 		addr = get_unshared_area(addr, len);
 	}



More information about the parisc-linux mailing list