From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Wed, 11 Jun 2014 14:04:33 -0400 To: 9fans@9fans.net Message-ID: <8977d7fab2c905e43577db135dc59751@brasstown.quanstro.net> In-Reply-To: <055f6bc9f00c19e6b8a81c434408e6e3@brasstown.quanstro.net> References: <055f6bc9f00c19e6b8a81c434408e6e3@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] duppage Topicbox-Message-UUID: f96e9756-ead8-11e9-9d60-3106f5b1d025 On Sun Jun 8 14:17:16 EDT 2014, quanstro@quanstro.net wrote: > On Sun Jun 8 13:55:52 EDT 2014, cinap_lenrek@felloff.net wrote: > > right. the question is, how did it vanish from the image cache. > > i think it is in the image cache, but .ref >1. perhaps independent of your question, my assumption is correct, and proven. the problem was that pagereclaim() only looked through pga.pgsza[0], but since 2MiB pages were introduced in nix, no pages could ever be reclaimed this way, since they would be in pga.pgsza[1]. i don't think this really addresses your question, or my original problem though. the corrected version which i think should work for any architecture is below. i intend to incorporate charles locking changes later on. (lock(&lga.pgsza[lg]) instead of the whole thing.) i think those changes (in the 9atom /sys/src/9 kernels) are good stuff. - erik --- /* * Called from imagereclaim, to try to release Images. * The (ignored) argument indicates a preferred image for release. */ void pagereclaim(Image*) { int lg, n; usize sz; Page *p; lock(&pga); /* * All the pages with images backing them are at the * end of the list (see putpage) so start there and work * backward. Assume the smallest page size (BOTCH). */ sz = 0; n = 0; for(lg = 0; lg < m->npgsz; lg++) for(p = pga.pgsza[lg].tail; p != nil; p = p->prev){ if(p->image != nil && p->ref == 0 && canlock(p)){ if(p->ref == 0) { n++; sz += 1<pgszlg2[lg]; uncachepage(p); } unlock(p); if(sz >= 20*MiB && n>5) break; } } unlock(&pga); }