[Pkg-gauche-devel] threads and fork on machine with VIPT-WB cache

NIIBE Yutaka gniibe at fsij.org
Fri Apr 2 08:05:43 UTC 2010


NIIBE Yutaka wrote:
> To have same semantics as other archs, I think that VIPT-WB cache
> machine should have cache flush at ptep_set_wrprotect, so that memory
> of the page has up-to-date data.  Yes, it will be huge performance
> impact for fork.  But I don't find any good solution other than this
> yet.

I think we could do something like (only for VIPT-WB cache machine):

-	static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned 
long address, pte_t *ptep)

+	static inline void ptep_set_wrprotect(struct vm_area_struct *vma, 
struct mm_struct *mm, unsigned long addr, pte_t *ptep)
	{
		pte_t old_pte = *ptep;
+		if (atomic_read(&mm->mm_users) > 1)
+			flush_cache_page(vma, addr, pte_pfn(old_pte));
		set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
	}

Here, we can add condition for the call of flush_cache_page
to avoid big performance impact for non threads case.
-- 



More information about the Pkg-gauche-devel mailing list