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] mmu fix?
Date: Thu, 12 Nov 2009 16:34:17 -0500	[thread overview]
Message-ID: <a95ee23550fd841f72dd45597b98756b@ladd.quanstro.net> (raw)
In-Reply-To: <<8a361ea78b8d25f710617b31c2eaf1ec@hamnavoe.com>>

On Thu Nov 12 16:20:39 EST 2009, 9fans@hamnavoe.com wrote:
> The two cases are:
>
> /sys/src/9/pc/mmu.c:510,513
> 			if(didmmuinit)
> 				map = xspanalloc(BY2PG, BY2PG, 0);
> 			else
> 				map = rampage();
>
> xspanalloc returns zeroed memory.  rampage is only called early
> in startup, and returns virgin memory which in the olden days
> would have been zeroed at boot time.  But nowadays:
>
> /sys/src/9/pc/memory.c:443
> 			/* memset(va, 0, MB); so damn slow to memset all of memory */
>
> So I think you want to clear the page only for the rampage case.
>

thanks, richard.  since rampage() doesn't zero memory
but xspanalloc does, it makes sense to me to put the change
in rampage instead of mmuwalk.

/n/dump/2009/1112/sys/src/9/pc/memory.c:223,233 - memory.c:223,236
  rampage(void)
  {
  	ulong m;
-
+ 	void *p;
+
  	m = mapalloc(&rmapram, 0, BY2PG, BY2PG);
  	if(m == 0)
  		return nil;
- 	return KADDR(m);
+ 	p = KADDR(m);
+ 	memset(p, 0, BY2PG);
+ 	return p;
  }

- erik



       reply	other threads:[~2009-11-12 21:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<8a361ea78b8d25f710617b31c2eaf1ec@hamnavoe.com>
2009-11-12 21:34 ` erik quanstrom [this message]
2009-11-12 20:57 erik quanstrom
2009-11-12 21:19 ` Richard Miller

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=a95ee23550fd841f72dd45597b98756b@ladd.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).