User: Password:
|
|
Subscribe / Log in / New account

Why add anything?

Why add anything?

Posted Mar 30, 2007 12:59 UTC (Fri) by mjr (guest, #6979)
In reply to: Why add anything? by ncm
Parent article: Application-friendly kernel interfaces

I'm wondering the same myself. I'm not much for low level hacking, but I fail to see what benefits one would reap from yet another interface.

If a separate interface is really necessary for some reason, I'd put the same functionality behind regular libc malloc(); it already does brk() for small allocations and mmap() for large ones I believe, so it could just as well do extra-large allocations via the hugetlb API. (Putting this in malloc instead of mmap would get rid of the partial-munmap issue on the libc end.)


(Log in to post comments)

Why add anything?

Posted Mar 30, 2007 23:19 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

I can see the value of using mmap() for this, but I don't think you want mmap() guessing based on the size of the request what page size is best.

It's quite possible that 16M of memory will consist of 100 scattered 4K pages of working set and the rest rarely used or even vacant. You wouldn't want to page the whole 16M in and out in that case.

Page granularity seems like a perfectly sensible parameter of an mmap, though.

Why add anything?

Posted Apr 5, 2007 14:15 UTC (Thu) by farnz (subscriber, #17727) [Link]

Might be worth looking at Linux-mm.org on huge pages. In particular, there's a link to an LWM article on transparent use of huge pages. The "holy grail" is very definitely transparent use, so that whenever possible, all applications gain; anything that makes it easier to move that way is helpful.

One thought; if your mmap parameter is simply a hint that the block will be used in a particular granularity, it's easy to implement. Current mmap sets the parameter to 1 byte (no granularity needed), unless mmaping in hugetlbfs pages, when it sets the parameter to (e.g.) 16M. The kernel then just rounds up to the next highest available page size when possible, or down if not.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds