Skip to contentSkip to conversation

linux-2.6 jejb

parisc-linux James Bottomley 2 participants 3 messages Apr 7, 2004 – Apr 8, 2004 1 message not in the archive PA-RISC architecture

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 9 lines · James Bottomley

CVSROOT: /var/cvs
Module name: linux-2.6
Changes by: jejb 04/04/06 18:49:01

Modified files:
. : Makefile
arch/parisc/kernel: cache.c
include/asm-parisc: cacheflush.h

Quoted 5 lines

Log message:
Optimise flush_cache_page

Now that we have a way of checking translations for a page, don't bother flushing if there's no translation.

Index: arch/parisc/kernel/cache.c
===================================================================
RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/cache.c,v retrieving revision 1.7

arch/parisc/kernel/cache.c +3 -29
diff -u -r1.7 cache.c
@@ -227,32 +227,6 @@
 	disable_sr_hashing_asm(srhash_type);
 }
 
-/* Simple function to work out if we have an existing address translation
- * for a user space vma. */
-static inline int translation_exists(struct vm_area_struct *vma,
-				     unsigned long addr)
-{
-	pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
-	pmd_t *pmd;
-	pte_t *pte;
-
-	if(pgd_none(*pgd))
-		return 0;
-
-	pmd = pmd_offset(pgd, addr);
-	if(pmd_none(*pmd) || pmd_bad(*pmd))
-		return 0;
-
-	pte = pte_offset_map(pmd, addr);
-
-	/* The PA flush mappings show up as pte_none, but they're
-	 * valid none the less */
-	if(pte_none(*pte) && ((pte_val(*pte) & _PAGE_FLUSH) == 0))
-		return 0;
-	return 1;
-}
-	   
-
 void __flush_dcache_page(struct page *page)
 {
 	struct mm_struct *mm = current->active_mm;
@@ -300,7 +274,7 @@
 			continue;
 
 
-		flush_cache_page(mpnt, addr);
+		__flush_cache_page(mpnt, addr);
 
 		/* All user shared mappings should be equivalently mapped,
 		 * so once we've flushed one we should be ok
@@ -312,7 +286,7 @@
 	if (anyvma) {
 		unsigned long addr = anyvma->vm_start
 			+ ((page->index - anyvma->vm_pgoff) << PAGE_SHIFT);
-		flush_cache_page(anyvma, addr);
+		__flush_cache_page(anyvma, addr);
 	}
 
  flush_unshared:
@@ -341,7 +315,7 @@
 		if(!translation_exists(mpnt, addr))
 			continue;
 
-		flush_cache_page(mpnt, addr);
+		__flush_cache_page(mpnt, addr);
 	}
 }
 EXPORT_SYMBOL(__flush_dcache_page);

Index: include/asm-parisc/cacheflush.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/asm-parisc/cacheflush.h,v retrieving revision 1.8

include/asm-parisc/cacheflush.h +38 -4

61 lines not on this page · raw message

#2 lore raw

Hi all,

Sorry first for bad wrapping (known pb with webmail interface :( ).

Now as far as remember .h files are headers and so should only contains declaration of function and not their definition excepted if they are very short (imho 3 line max) but that is a personal limit: does it exist a common agreement on this limit?
And here why changing translation_exists() definition location?

That said, I tested 2.6.5-pa5 32bit on a b2k and 64bits (gcc-3.0.4 from ftp.p-l.org) on a n4k and they works fine. (I couldn't just reproduce Grant pb because no usb device available :( )

Sorry if I annoye with philosophical question and thanks for great job as well as additional for info,
Joel

Quoted 19 lines

-- Original Message --
From: James Bottomley <[email protected]>
To: PARISC list <[email protected]>
Date: 06 Apr 2004 19:54:21 -0500
Cc: [email protected]
Subject: [parisc-linux] Re: [parisc-linux-cvs] linux-2.6 jejb

On Tue, 2004-04-06 at 19:49, James Bottomley wrote:
CVSROOT: /var/cvs
Module name: linux-2.6
Changes by: jejb 04/04/06 18:49:01

Modified files:
. : Makefile
arch/parisc/kernel: cache.c
include/asm-parisc: cach
flush.h

Quoted 5 lines

Log message:
Optimise flush_cache_page

Now that we have a way of checking translations for a page, don't bother flushing if there's no translation.

Index: arch/parisc/kernel/cache.c
=====================================

Quoted 1 line

=============================

RCS file: /var/cvs/linux-2.6/arch/parisc/kernel/cache.c,v retrieving revision 1.7

arch/parisc/kernel/cache.c +0 -0
diff -u -r1.7 cache.c
Quoted 1 line

5 -0000

@@ -227,32 +227,6 @@
disable_sr_hashing_asm(srhash_type);
}

-/* Simple function to work out if we have an existing address translation
- * for a user space vma. */
-static inline int translation_exists(struct vm_area_struct *vma, -

Quoted 1 line

unsigned long addr)

-{
- pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
- pmd_t *pmd;
- pte_t *pte;
-
- if(pgd_none(*pgd))
- return 0;
-
- pmd = pmd_offset(pgd, addr);
- if(pmd_none(*pmd) || pmd_bad(*pmd))
- return 0;
-
- pte = pte_o

Quoted 1 line

fset_map(pmd, addr);

-
- /* The PA flush mappings show up as pte_none, but they're
- * valid none the less */
- if(pte_none(*pte) && ((pte_val(*pte) & _PAGE_FLUSH) == 0))
- return 0;
- return 1;
-}
-
-
void __flush_dcache_page(struct p

Quoted 1 line

ge *page)

{
struct mm_struct *mm = current->active_mm;
@@ -300,7 +274,7 @@
continue;

- flush_cache_page(mpnt, addr);
+ __flush_cache_page(mpnt, addr);

/* All user shared mappings should be equivalently mapped,
* so once

Quoted 1 line

e've flushed one we should be ok

@@ -312,7 +286,7 @@
if (anyvma) {
unsigned long addr = anyvma->vm_start
+ ((page->index - anyvma->vm_pgoff) << PAGE_SHIFT);
- flush_cache_page(anyvma, addr);
+ __flush_cache_page(anyvma, addr);
}

Quoted 1 line

flush_unshared:

@@ -341,7 +315,7 @@
if(!translation_exists(mpnt, addr))
continue;

- flush_cache_page(mpnt, addr);
+ __flush_cache_page(mpnt, addr);
}
}
EXPORT_SYMBOL(__flush_dcache_page);
Index: include/asm-parisc/cacheflush.

Quoted 1 line

===================================================================
RCS file: /var/cvs/linux-2.6/include/asm-parisc/cacheflush.h,v retrieving revision 1.8
diff -u -r1.8 cacheflush.h
--- a/include/asm-parisc/cacheflush.h 5 Apr 2004 17:41:30 -0000

Quoted 1 line

.8

+++ b/include/asm-parisc/cacheflush.h 7 Apr 2004 00:17:15 -0000
@@ -107,6 +107,32 @@
}
}

+/* Simple function to work out if we have an existing address translation
+ * for a user space vma. */
+static inline int translation_exists(struc

Quoted 1 line

vm_area_struct *vma,

+ unsigned long addr)
+{
+ pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
+ pmd_t *pmd;
+ pte_t *pte;
+
+ if(pgd_none(*pgd))
+ return 0;
+
+ pmd = pmd_offset(pgd, addr);
+ if(pmd_none(*pmd) || pmd_bad(*pmd))
+ re

Quoted 1 line

urn 0;

+
+ pte = pte_offset_map(pmd, addr);
+
+ /* The PA flush mappings show up as pte_none, but they're
+ * valid none the less */
+ if(pte_none(*pte) && ((pte_val(*pte) & _PAGE_FLUSH) == 0))
+ return 0;
+ return 1;
+}
+
+
/* Private f

Quoted 1 line

nction to flush a page from the cache of a non-current

* process. cr25 contains the Page Directory of the current user
* process; we're going to hijack both it and the user space %sr3 to
@@ -141,17 +167,25 @@
}

static inline void
-flush

Quoted 1 line

cache_page(struct vm_area_struct *vma, unsigned long vmaddr)

+__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
{
- BUG_ON(!vma->vm_mm->context);
-
- if (vma->vm_mm->context == mfsp(3)) {
+ if (likely(vma->vm_mm->context == mf

Quoted 1 line

p(3))) {

flush_user_dcache_page(vmaddr);
if (vma->vm_flags & VM_EXEC)
flush_user_icache_page(vmaddr);
} else {
flush_user_cache_page_non_current(vma, vmaddr);
}
+}
+
+static inline void
+flush_cache_page(struct vm_area_struct

Quoted 1 line

*vma, unsigned long vmaddr)

+{
+ BUG_ON(!vma->vm_mm->context);
+
+ if(likely(translation_exists(vma, vmaddr)))
+ __flush_cache_page(vma, vmaddr);
+
}
#endif

_______________________________________________
parisc-linux mailing list
pa

Quoted 1 line

[email protected]

http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

----------------------------------------------------------------------------------------
Tiscali ADSL: 35 €/mois, la meilleure offre du marché!
http://reg.tiscali.be/default.asp?lg=fr

#3 lore raw
Quoted 5 lines · Joel Soete

Now as far as remember .h files are headers and so should only contains declaration of function and not their definition excepted if they are very short (imho 3 line max) but that is a personal limit: does it exist a common agreement on this limit?
And here why changing translation_exists() definition location?

Because it's an inline function. To move an inline function to a place shareable by other files it has to go into a header.

James