home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sgi / 12566 < prev    next >
Encoding:
Text File  |  1992-08-18  |  3.3 KB  |  67 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!news
  3. From: philip@ziggy.stanford.edu (Philip Machanick)
  4. Subject: Re: finding page size?
  5. Message-ID: <1992Aug18.213842.6074@CSD-NewsHost.Stanford.EDU>
  6. Sender: news@CSD-NewsHost.Stanford.EDU
  7. Reply-To: philip@ziggy.stanford.edu (Philip Machanick)
  8. Organization: CS Department, Stanford University, California, USA
  9. References: <l92h9dINNeqj@spim.mips.com>
  10. Date: Tue, 18 Aug 1992 21:38:42 GMT
  11. Lines: 54
  12.  
  13. In article <l92h9dINNeqj@spim.mips.com> mash@mips.com (John Mashey) writes:
  14. > In article <onughl0@zuni.esd.sgi.com> olson@anchor.esd.sgi.com (Dave Olson)  
  15. writes:
  16. > To amplify this a little more, and perhaps stir up some discussion
  17. > about what people should be doing later:
  18. >     a) As Dave says, R4000s support multiple page sizes, and you certainly
  19. >     don't want to build 4K into your programs.
  20. >     b) This means, not only might different programs have different
  21. >     sized pages ... but different parts of the same program might
  22. >     have different-sized pages ... and in fact, there are ways of
  23. >     using the R4000 TLB where the page size of a given chunk of
  24. >     virtual memory changes around during execution....
  25. > Hence, this leads to the question: if you are using the result of  
  26. getpagesize,
  27. > what are you expecting it to tell you, and how are you using it?
  28. > This might provide some guidance about what getpagesize ought to do
  29. > in an OS that really uses multiple sizes at the same time.
  30. > Note that getpagesize explicitly says its return is not necesarily
  31. > the size of underlying hardware pages....
  32. > In a multiple-page size environment, there are at least the following
  33. > potential values that might make sense:
  34. > a) 4K: the minimum possible size of allocation.
  35. > b) 8K: 2 of those, since the R4000's TLB conveniently pairs pages,
  36. > and there might be some advantage under some schemes in allocating 8K chunks.
  37. > c) XK, where X is the *largest* size that the OS is willing to put in the  
  38. TLB,
  39. > i.e., so that asking for this much space could be a good hint to the OS to
  40. > allocate this much much physical memory in one chunk and be able to map it
  41. > with a single TLB entry.
  42.  
  43. My problem is with object-oriented (C++) code where objects are allocated  
  44. randomly. For a reasonably long time the same objects are in some sense close  
  45. together (locality) but because they are randomly allocated they end up being  
  46. on a large number of pages (probably one page per object). A result of this is  
  47. probably a high number of TLB misses. I have done a temporary workaround by  
  48. allocating related objects out of the same page (which I carve up into a free  
  49. list). When an object moves to a different part of the data structures, I  
  50. reallocate it out of pages that its new "neighbours" are allocated out of.
  51.  
  52. If future architectures have a much lower TLB miss cost this problem would go  
  53. away. Much larger page sizes could help by reducing the probability that data  
  54. allocated at different times ends up on a different page and virtually  
  55. addressed caches would be a help. Since the data fits in RAM it may make sense  
  56. for a page size = total RAM requirement. I haven't finished measurements and  
  57. testing but the performance impact of TLB misses in this case appears to be  
  58. about 20%.
  59.  
  60. [Not really relevant but the program is a particle-based wind tunnel  
  61. simulation.]
  62. --
  63. Philip Machanick
  64. philip@pescadero.stanford.edu
  65.