-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for huge TLB pages on Linux #97
Conversation
sigar_linux_common.go
Outdated
} else { | ||
// If Hugetlb is not present, or huge pages of different sizes | ||
// are used, this cipher can be unaccurate. | ||
// TODO (jsoriano): Extract information from /sys/kernel/mm/hugepages too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it is so common to use custom sizes for huge pages.
sigar_linux_common.go
Outdated
self.Surplus, _ = table["HugePages_Surp"] | ||
self.DefaultSize, _ = table["Hugepagesize"] | ||
|
||
if totalSize, found := table["Hugetlb"]; found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value is documented, but I haven't seen it in any running Linux I could check now.
1e1a6bb
to
1981278
Compare
1981278
to
5c1d2aa
Compare
Could you add a stub returning |
5c1d2aa
to
1775461
Compare
Added, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @andrewkroh are you ok with merging this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsoriano Welcome to the team! The code you added looks good.
I am slightly concerned about the further expansion of the Sigar interface. This isn't a new issue. And it reminds me of "The bigger the interface, the weaker the abstraction" from Rob Pike's talk.
Do you think we will ever add HugeTLBPages
implementations for OSes other than Linux? If not, then maybe gosigar isn't the right place for this. Perhaps adding a MemInfo
type to procfs would be a better home for this.
I'm interested to hear what others think about this.
There seem to be also superpages in FreeBSD and large pages in Windows, I guess there will also be similar concepts in Mac, OpenBSD... What I haven't checked is their metric interfaces and terminology, maybe we can find a less linux-specific naming. |
1775461
to
2327e76
Compare
I have moved the code from the linux_common to the linux file. The linux_common file is also used by freebsd and freebsd implementation is quite different. |
Added a commit renaming this to |
The hardest problem is always naming. I think using Large, Huge, or Super in the name is better than creating a fourth one of "Larger". I'm going to hedge my bets and say that we will probably never implement it for any other OSes so we should stick with "Huge". Can you undo the last commit with the rename? |
Commit with the rename removed :) |
Add initial support for huge TLB pages on Linux, as requirement for elastic/beats#6351.