By: Maynard Handley (name99.delete@this.name99.org), May 15, 2013 3:33 pm
Room: Moderated Discussions
Ungo (a.delete@this.b.c.d.e) on May 15, 2013 12:15 pm wrote:
> Maynard Handley (name99.delete@this.name99.org) on May 14, 2013 5:49 pm wrote:
> > There is trivial scope for wider use of 2MiB pages. For example, OSX uses a magazine malloc, which uses
> > three zones for small, medium and large allocations. The small and medium zones are initially allocated
> > as 2MiB in size, and grow by 2MiB a pop. (Large allocations are allocated as some number of 4KiB pages.)
> >
> > It would (IMHO) be an appropriate optimization to make these small and medium zones allocated right off the
> > bat as 2MiB pages. (For all I know, the latest OSX does this, but Apple is so secretive that WTF knows.)
>
> Apple is secretive about many things, but not that. They still post source. I'm
> sure if they're supporting 2MiB pages, evidence can be found in the kernel:
>
> http://opensource.apple.com/source/xnu/xnu-2050.22.13/
>
I don't know my way around the Darwin source tree, but both a manual exploration and a Google site specific search did not reveal anything helpful. There IS a malloc.c (not in the xnu tree, but at http://www.opensource.apple.com/source/Libc/Libc-498/gen/malloc.c), however it is basically a thin adaptor layer between the malloc API and an internal zone-based API. The zone calls live in objc/zone.c, and a google search did not turn up a public version of that file.
> Maynard Handley (name99.delete@this.name99.org) on May 14, 2013 5:49 pm wrote:
> > There is trivial scope for wider use of 2MiB pages. For example, OSX uses a magazine malloc, which uses
> > three zones for small, medium and large allocations. The small and medium zones are initially allocated
> > as 2MiB in size, and grow by 2MiB a pop. (Large allocations are allocated as some number of 4KiB pages.)
> >
> > It would (IMHO) be an appropriate optimization to make these small and medium zones allocated right off the
> > bat as 2MiB pages. (For all I know, the latest OSX does this, but Apple is so secretive that WTF knows.)
>
> Apple is secretive about many things, but not that. They still post source. I'm
> sure if they're supporting 2MiB pages, evidence can be found in the kernel:
>
> http://opensource.apple.com/source/xnu/xnu-2050.22.13/
>
I don't know my way around the Darwin source tree, but both a manual exploration and a Google site specific search did not reveal anything helpful. There IS a malloc.c (not in the xnu tree, but at http://www.opensource.apple.com/source/Libc/Libc-498/gen/malloc.c), however it is basically a thin adaptor layer between the malloc API and an internal zone-based API. The zone calls live in objc/zone.c, and a google search did not turn up a public version of that file.