9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] duppage
Date: Wed, 11 Jun 2014 14:04:33 -0400	[thread overview]
Message-ID: <8977d7fab2c905e43577db135dc59751@brasstown.quanstro.net> (raw)
In-Reply-To: <055f6bc9f00c19e6b8a81c434408e6e3@brasstown.quanstro.net>

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<<m->pgszlg2[lg];
					uncachepage(p);
				}
			unlock(p);
			if(sz >= 20*MiB && n>5)
				break;
		}
	}
	unlock(&pga);
}



  parent reply	other threads:[~2014-06-11 18:04 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-08 14:53 erik quanstrom
2014-06-08 17:15 ` cinap_lenrek
2014-06-08 17:22 ` Charles Forsyth
2014-06-08 17:34   ` erik quanstrom
2014-06-08 17:50     ` Charles Forsyth
2014-06-08 17:53       ` erik quanstrom
2014-06-08 17:54       ` cinap_lenrek
2014-06-08 18:15         ` erik quanstrom
2014-06-08 18:37           ` Charles Forsyth
2014-06-09  8:23             ` Charles Forsyth
2014-06-09 13:21               ` erik quanstrom
2014-06-10  1:35               ` erik quanstrom
2014-06-10  3:53                 ` cinap_lenrek
2014-06-10 12:58                   ` erik quanstrom
2014-06-10 13:56                     ` Steve Simon
2014-06-10 15:30                       ` erik quanstrom
2014-06-10 14:06                     ` cinap_lenrek
2014-06-11 18:04           ` erik quanstrom [this message]
2014-06-08 17:49   ` cinap_lenrek
  -- strict thread matches above, loose matches on Subject: below --
2012-03-13 23:55 erik quanstrom
2012-02-25  3:29 cinap_lenrek
2012-02-25 20:09 ` Charles Forsyth
2012-02-26  4:13 ` erik quanstrom
2012-02-29 10:31 ` Richard Miller
2012-02-29 14:14   ` cinap_lenrek
2012-02-29 19:35     ` Richard Miller
2012-02-29 19:50       ` cinap_lenrek
2012-03-03  9:58         ` Richard Miller
2012-03-03 19:30           ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8977d7fab2c905e43577db135dc59751@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).