Subject: Re: pmap_protect() implementation
To: None <port-mips@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-mips
Date: 03/29/2000 07:48:25
On Wed, Mar 29, 2000 at 06:53:24PM +0900, Toru Nishimura wrote:
> Isn't it ridiculous pmap_protect() does following, is it?
Yes :-)
> while (sva < eva) {
> ...
> pte = ...
> for (; sva < nssva; sva += NBPG, pte++) {
> entry = pte->pt_entry;
> if (!mips_pg_v(entry))
> continue;
> entry = (entry & ~(mips_pg_m_bit() |
> mips_pg_ro_bit())) | p;
> pte->pt_entry = entry;
> ...
> MachTLBUpdate(sva | asid, entry);
> }
> }
>
> When pmap_protect() is called by uvmspace_fork1(), code above fills a
> bunch of entries into TLB which has only the capacity of 56, I think.
Right, if it were me, I'd instead flush the entries from the TLB, and let
them get refilled via a miss.
Alternatively, MachTLBUpdate() could be changed to only update an entry
if it exists in the TLB, which might make some sense; that could be less
expensive than just nuking it and then letting a miss occur.
--
-- Jason R. Thorpe <thorpej@zembu.com>