Subject: Re: a new pmap_copy_page() and pmap_zero_page()
To: Toru Nishimura <locore32@gaea.ocn.ne.jp>
From: Rafal Boni <rafal@pobox.com>
List: port-mips
Date: 10/07/2003 18:16:09
[I've reformatted your reply a litte to make it easier to read after my
 reply markers shuffled it off the end of the 80 col. window]

In message <000701c38cad$771d8500$0a00a8c0@PAQ2>, you write: 

-> > It's not perfect solution to have the new copy/zero because the whole 
-> > issue here comes from the fact those pmap routines have no clue of
-> > target VA.  Necessity to change some in MI (U)VM arena.
-> 
-> It'd not be hard to do after all.   Let say that the target MIPS processor
-> has 32KB 4way configuration.  This brings 8KB cache slide, that is, two
-> page worth of VA to cover the cache, page and odd page.  Kernel can reserve
-> 2 page worth of VA range in this case.

I already reserve VA for the R5k case, but (to me) the hard part is how
to match that up with the VA the page will eventually use (my code only
reserves two pages worth, since zero only needs one and copy needs two,
but if I knew how to get at the VA-to-be of the page being operated on,
it would certainly not be a lot of work to reserve more :-).

-> Now, pmap_zero_page() is called as the consequence of ZFOD (zero fill on
-> demand for a page) event occurs.  If pmap_zero_page() knew the target VA,
-> it could assign an appropriate range of reserved VA (even or odd) to clear
-> out the target page content.  There would be no necessity to flush/invalid-
-> ate the write-back cache lines since forthcoming page access does hit the
-> correct cache lines which were left by pmap_zero_page() call.

Yep, that would be nice.  But again *if* we new the target VA.

-> There are possible cases when src VA and dst VA might disagree in cache
-> slide, for example, fancy address sharing to go.  However, kernel should
-> have full control in choosing the new VA of these cases, and then diffi-
-> culties can be avoid.

I'm not sure full control is possible w/out limiting how users map pages
via mmap, etc.  I'm quite sure I'd rather take the perf. hit than limit
the users' ability to shoot at their feet ;-)

--rafal

----
Rafal Boni                                                     rafal@pobox.com
  We are all worms.  But I do believe I am a glowworm.  -- Winston Churchill