Re: Hugepages for shm page cache (defrag)
From: Hugh Dickins <hughd@google.com>
Date: 2011-07-15 19:50:29
Possibly related (same subject, not in this thread)
- 2011-07-06 · Hugepages for shm page cache (defrag) · Radosław Smogura <hidden>
On Thu, 14 Jul 2011, mail@rsmogura.net wrote:
I working to remove errors from patch, and I integrated it with current THP infrastructure a little bit,
Great, thank you.
but I want ask if following I do following - it's about get_page, put_page, get_page_unless_zero, put_page_test_zero. I want following logic I think it may be better (in x86): 1) Each THP page will start with 512 refcount (self + 511 tails) 2) Each get/put will increment usage count only on this page, same test variants will do (currently those do not make this, so split is broken) 3) On compounds put page will call put_page_test_zero, if true, it will do compound lock, ask again if it has 0, if yes it will decrease refcount of head, if it will fall to zero compound will be freed (double check lock). 4) Compound lock is this what caller will need to establish if it needs to operate on transparent huge page in whole. Motivation: I operate on page cache, many assumptions about concurrent call of put/get_page are and plain using those causes memory leaks, faults, dangling pointers, etc when I'm going to split compound page. Is this acceptable?
Sounds plausible, but I really don't know. I do remember that refcounting compounds by head or by tail always raises questions (and access via get_user_pages() is an easily-overlooked path that needs to be kept in mind). But where THP stands today, and how it needs to be changed for this, I have no idea - whereas Andrea, perhaps, will recognize some of your points above and have a more useful response. It's clear that you have much more of a grip on these details than I have at present, so just be guided by the principle of not slowing down the common paths. Hugh -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>