>>>>> On Fri, 4 Feb 2005 09:44:10 -0800, Jun Sun <jsun@junsun.net> said:
jsun> It seems to me a naive solution is to introduce a spinlock to
jsun> make all three operation automic. you flush tlb first and make
jsun> relavent tlb fault handling sync with this spinlock as well.
jsun> At in theory it should fix the problem, but the spinlock might
jsun> be held for too long this dup_mmap().
Yes, it may be too long. Also dup_mmap might sleep via alloc_pages,
cond_resched_lock, etc. therefore the spinlock can not be held
entirely. Now I think fixing copy_cow_page() might be a way to go.
jsun> BTW, is this problem real or hypothetic?
Yes. This is a real problem. Using fork() in multi-thread program
should be legal and perhaps only way to call external program
(system() will use fork() internally). It will not be a special case.
---
Atsushi Nemoto
|