linux-mips
[Top] [All Lists]

Re: dcache aliasing problem on fork

To: jsun@junsun.net
Subject: Re: dcache aliasing problem on fork
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Sat, 05 Feb 2005 21:06:48 +0900 (JST)
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <20050204174410.GC30430@gw.junsun.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20050204.183813.132760959.nemoto@toshiba-tops.co.jp> <20050204174410.GC30430@gw.junsun.net>
Sender: linux-mips-bounce@linux-mips.org
>>>>> 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

<Prev in Thread] Current Thread [Next in Thread>