From: David W. <dw...@in...> - 2001-09-11 21:47:32
|
dr...@re... said: > Then fix the kernel. The change is necessary and correct. I suppose it is feasible for the kernel to accommodate MAP_ANONYMOUS mmap at the 'wrong' page addresses. Whether it _should_ do that or not sort of depends on how good the reasons are for not specifying MAP_FIXED in libpthread when you obviously seem to have meant it that way. I think a combination of mmap(MAP_ANONYMOUS|MAP_SHARED); fork(); mremap(MAP_FIXED) may still get the SH4 to screw up, but I think that was the case anyway. Mremap seems to be fundamentally broken in that respect - it doesn't have the same hooks (arch_get_unmapped_area()) that mmap() has to allow the arch code to vet the addresses use. I'll leave that one as an exercise for the reader. Index: arch/sh/kernel/sys_sh.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/kernel/sys_sh.c,v retrieving revision 1.7 diff -u -r1.7 sys_sh.c --- arch/sh/kernel/sys_sh.c 2001/08/03 23:50:59 1.7 +++ arch/sh/kernel/sys_sh.c 2001/09/11 21:39:00 @@ -68,7 +68,9 @@ if (!addr) addr = TASK_UNMAPPED_BASE; - addr = COLOUR_ALIGN(addr); + /* We don't need to do the cache colouring for anonymous pages */ + if (filp) + addr = COLOUR_ALIGN(addr); for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { /* At this point: (!vma || addr < vma->vm_end). */ @@ -77,7 +79,8 @@ if (!vma || addr + len <= vma->vm_start) return addr; addr = vma->vm_end; - addr = COLOUR_ALIGN(addr); + if (filp) + addr = COLOUR_ALIGN(addr); } } #endif -- dwmw2 |