From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sun, 2 Mar 2014 19:46:41 +0100 From: cinap_lenrek@felloff.net To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] imagereclaim() Topicbox-Message-UUID: c0e577a6-ead8-11e9-9d60-3106f5b1d025 you'r right. the smartness of duppage() isnt really neccesary. we can just leave the cache alone. when memory is low, newpage() will uncache pages for us. fixfault(): ... lkp = *pg; lock(lkp); if(lkp->ref == 0) panic("fault %#p ref == 0", lkp); if(lkp->ref == 1 && lkp->image == nil) { unlock(lkp); } else if(lkp->image == &swapimage && (lkp->ref + swapcount(lkp->daddr)) == 1) { uncachepage(lkp); unlock(lkp); } else { unlock(lkp); new = newpage(0, &s, addr); if(s == 0) return -1; *pg = new; copypage(lkp, *pg); putpage(lkp); } mmuphys = PPN((*pg)->pa) | PTEWRITE | PTEVALID; (*pg)->modref = PG_MOD|PG_REF; break; -- cinap