Configuring Huge Pages with Menuconfig

Moderators: mdrjr, odroid

Configuring Huge Pages with Menuconfig

Unread postby hominoid » Wed Sep 05, 2018 12:30 pm

Configuring Pre-allocated & Transparent Huge Pages with Menuconfig
I recently have been reading up on huge pages and their deployment. The limited number of posts regarding configuring huge pages on the forum have all referenced the original thread on the subject by @birty and it also suggests that huge pages is possible broke. The work around is to start out by manually editing the kernel .config file to enable LPAE because the kernel huge page variables in menuconfig are not visible. I believe some of the problems people have had in the past may be related to all the kernel variable not being set. Many of the threads do not differentiate between Pre-allocated Huge Pages or Transparent Huge Page settings or which they are trying to use. After studying the menuconfig application and trail and error, I have solved the mystery.
Change the following settings in this specific order:
Code: Select all
System Type ---> Support for the Large Physical Address Extension
Kernel Features ---> Transparent Hugepage Support
                        Transparent Hugepage Support sysfs defaults (always) --->
File systems --->
  Pseudo filesystems --->
    HugeTLB file system support
Control Group support ---> HugeTLB controller

Support for Large Physical Address Extension (LPAE) must be enabled first to see most of the Huge Page settings in menuconfig. Even though Control Group support is on by default for Odroid kernels, it will not display the HugeTLB controller variable until all the others are enabled. So go back to it and enter the submenu by using return, not the space bar, for the final setting. Do not vary from the order presented or you will most likely not see all the variables. After configuring huge pages with make menuconfig command the following variables should be set. If they are not you missed one or varied from the specific order presented.
Code: Select all
cat .config | grep HUGE

CONFIG_CGROUP_HUGETLB=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y
# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set
CONFIG_TRANSPARENT_HUGE_PAGECACHE=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y

Note: CONFIG_TRANSPARENT_HUGEPAGE_MADVISE and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS are a binary choice and can be changed dynamical in the OS.

Continue with the normal kernel build process and you will have access to both Pre-allocated and Transparent Huge Pages. I'm still testing both subsystems but have not had a problem with either one so far. One other note for Ubuntu 16.04 Minimal image and Ubuntu 18.04 Minimal image, there are additional dependencies not listed in the HK Odroid Wiki for rebuilding the XU4/MC1/HC1/HC2 kernel. So be sure to install them first otherwise make menuconfig will not start (ncurses-dev) and the rebuild will fail (bc and libssl-dev).
Code: Select all
sudo apt install ncurses-dev bc libssl-dev
hominoid
 
Posts: 186
Joined: Tue Feb 28, 2017 3:55 am
Location: Lake Superior Basin, USA
languages_spoken: english
ODROIDs: C2, XU4, MC1, N1

Re: Configuring Huge Pages with Menuconfig

Unread postby rooted » Wed Sep 05, 2018 3:44 pm

That's an interesting bit of information.

Ideally if you enable a kernel option manually by editing the .config you can simply run "make oldconfig" which will present you with questions about enabling the options needed to enable the feature.

I'm not sure if this is relevant here but it could be.
User avatar
rooted
 
Posts: 5474
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Configuring Huge Pages with Menuconfig

Unread postby hominoid » Thu Sep 06, 2018 2:11 am

rooted wrote:That's an interesting bit of information.

Ideally if you enable a kernel option manually by editing the .config you can simply run "make oldconfig" which will present you with questions about enabling the options needed to enable the feature.

I'm not sure if this is relevant here but it could be.

Yes, on reading up I came across that but it didn't make sense why menuconfig seemed it wasn't working so I spent some time exploring. I'm far from expert in this area so a lot of what I was doing was trying to come up to speed and understand what was going on, likewise with huge pages in general. Some of the applications I'm working with might benefit from using them and frankly before I started, I didn't know the difference between the pre-allocated and transparent huge pages or why I would want one over the other. After finishing this weekend I have a much better understanding. Looking over all the notes I took, I have close to a a basic primer on the subject which I will most likely pull together and post for others like myself who need a basic understanding of huge pages available in a single location. I know you have done a lot of kernel development, as have others, so your input is valuable to me, thanks @rooted.
hominoid
 
Posts: 186
Joined: Tue Feb 28, 2017 3:55 am
Location: Lake Superior Basin, USA
languages_spoken: english
ODROIDs: C2, XU4, MC1, N1

Re: Configuring Huge Pages with Menuconfig

Unread postby mad_ady » Thu Sep 06, 2018 2:31 am

Since you were taking notes, perhaps you can compile them into an article for the magazine as well. I'd love to learn more.
User avatar
mad_ady
 
Posts: 4466
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Configuring Huge Pages with Menuconfig

Unread postby hominoid » Thu Sep 06, 2018 5:10 am

mad_ady wrote:Since you were taking notes, perhaps you can compile them into an article for the magazine as well. I'd love to learn more.

It probably is a good candidate for a Odroid Magazine article. I'll see what I can do. This subject is complex and cuts across processor architecture, memory management design, kernel configuration, application development and end user deployment so I'll post the primer on the forum first for review by the many experts here. It's easy to add to, correct or clarify a forum post, not so much so for a magazine article. :) I'll target those like myself who are looking for a basic understanding of huge pages and their configuration and impact on application deployment.
hominoid
 
Posts: 186
Joined: Tue Feb 28, 2017 3:55 am
Location: Lake Superior Basin, USA
languages_spoken: english
ODROIDs: C2, XU4, MC1, N1


Return to Ubuntu

Who is online

Users browsing this forum: freefall99 and 6 guests