Hugepages - how to enable?

Post Reply
turtleminor13
Posts: 3
Joined: Wed Sep 11, 2019 11:33 am
languages_spoken: english
ODROIDs: N2
Location: USA
Has thanked: 0
Been thanked: 0
Contact:

Hugepages - how to enable?

Post by turtleminor13 »

I've just gotten a N2 and I'm using the latest Odroid Ubuntu minimal: ubuntu-18.04.3-4.9-minimal-odroid-n2-20190806.img
It seems huge pages are not available? On other Ubuntu systems I'm able to get huge pages with the command --> "sudo sysctl -w vm.nr_hugepages=13"
With this N2 ubuntu system I get the error --> "sysctl: cannot stat /proc/sys/vm/nr_hugepages: No such file or directory"

Are there instructions somewhere for enabling hugepages in Ubuntu on the N2?

Thanks

igorpec
Posts: 644
Joined: Sat Dec 12, 2015 4:34 pm
languages_spoken: english,german,slovene
ODROIDs: XU4, HC1, C2, C1+
Has thanked: 32 times
Been thanked: 84 times
Contact:

Re: Hugepages - how to enable?

Post by igorpec »

> Are there instructions somewhere for enabling hugepages in Ubuntu on the N2?

Apparently you need to recompile the kernel and enable it.
ARMBIAN
Linux for ARM development boards

Download latest images for Odroids | Build them from sources | Donate to support development

turtleminor13
Posts: 3
Joined: Wed Sep 11, 2019 11:33 am
languages_spoken: english
ODROIDs: N2
Location: USA
Has thanked: 0
Been thanked: 0
Contact:

Re: Hugepages - how to enable?

Post by turtleminor13 »

I was using the Odroid Ubuntu image in order to have OpenCL on the N2 mali gpu, but moved over to Armbian to have hugepages with no messing around.
Then I installed Odroid's mali opencl driver on Armbian, and it's working.

igorpec
Posts: 644
Joined: Sat Dec 12, 2015 4:34 pm
languages_spoken: english,german,slovene
ODROIDs: XU4, HC1, C2, C1+
Has thanked: 32 times
Been thanked: 84 times
Contact:

Re: Hugepages - how to enable?

Post by igorpec »

> Then I installed Odroid's mali opencl driver on Armbian, and it's working.

On which way?
ARMBIAN
Linux for ARM development boards

Download latest images for Odroids | Build them from sources | Donate to support development

hominoid
Posts: 437
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2
Location: Lake Superior Basin, USA
Has thanked: 39 times
Been thanked: 124 times
Contact:

Re: Hugepages - how to enable?

Post by hominoid »

Here is a quick guide to enableing Pre-allocated and Transparent Hugepages for Ubuntu on th N2.

Code: Select all

hominoid@odroid-n2:~$ uname -a
Linux odroid-n2 4.9.190-62 #1 SMP PREEMPT Tue Sep 10 01:00:59 -03 2019 aarch64 aarch64 aarch64 GNU/Linux

Code: Select all

hominoid@odroid-n2:~$ ls /sys/kernel/mm/
Reference for cross compile and native N2 kernel build.

Code: Select all

hominoid@odroid-n2:~$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidn2-4.9.y
hominoid@odroid-n2:~$ cd linux
hominoid@odroid-n2:~/linux$ make odroidn2_defconfig
Since kernel parameters change and different vendor's kernel configuration are usually different, I like to know were I'm starting.

Code: Select all

hominoid@odroid-n2:~/linux$ cat .config | grep HUGE
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
# CONFIG_TRANSPARENT_HUGEPAGE is not set
# CONFIG_HUGETLBFS is not set
# CONFIG_HUGETLB_PAGE is not set

Code: Select all

hominoid@odroid-n2:~/linux$ make menuconfig

Code: Select all

kernel features -> Transparent Hugepage Support
File System -> Pseudo filesystems -> HugeTLB file system support
General setup -> Control Group support -> HugeTLB controller
Double esc to backup and exit within Menuconfig, search using /. Parameters are order sensitive. On some platforms(XU4) kernel support for Large Physical Address Extension (LPAE) must be enabled first to see the Hugepage settings in menuconfig. After the above changes are complete exit and save the config and check that all settings are enabled.

Code: Select all

hominoid@odroid-n2:~/linux$ cat .config | grep HUGE
CONFIG_CGROUP_HUGETLB=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=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.

Code: Select all

hominoid@odroid-n2:~/linux$ make -j4
hominoid@odroid-n2:~/linux$ sudo make modules_install
hominoid@odroid-n2:~/linux$ sudo cp -f arch/arm64/boot/Image.gz arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtb /media/boot/
hominoid@odroid-n2:~/linux$ sudo sync
hominoid@odroid-n2:~/linux$ sudo reboot

Code: Select all

hominoid@odroid-n2:~$ uname -a
Linux odroid-n2 4.9.190+ #1 SMP PREEMPT Fri Sep 20 11:20:36 EDT 2019 aarch64 aarch64 aarch64 GNU/Linux

Code: Select all

hominoid@odroid-n2:~$ ls /sys/kernel/mm/
hugepages  transparent_hugepage
Most applications will use transparent hugepages and since transparent huge pages are dynamically allocated and not reserved, there isn't much else to do. Pre-allocated hugepages require additional OS setup that is specific to the application using them so I'm not going to cover them here.

EDIT: See the application specific installation guide for OS setup of those applications that use Pre-allocated Hugepages.

turtleminor13
Posts: 3
Joined: Wed Sep 11, 2019 11:33 am
languages_spoken: english
ODROIDs: N2
Location: USA
Has thanked: 0
Been thanked: 0
Contact:

Re: Hugepages - how to enable?

Post by turtleminor13 »

@igorpec -
I followed Odroid's instructions for opencl here: https://wiki.odroid.com/odroid-n2/os_im ... u/20190806
Except Armbian doesn't have the Odroid repositories, so the driver download step "apt download mali-fbdev" failed. So I manually copied this file from the Odroid Ubuntu image where I had previously installed it. Then clinfo shows Mali-G52 opencl on Armbian.

@hominoid -
Thanks for providing the detailed instructions for hugepages kernel compile. Do you know why the official Odroid Ubuntu image doesn't already have this?
BTW - I have seen your older post about CPU+GPU mining. This is why I want both hugepages and Opencl, and I have just gotten dual mining running on the N2 with recent beta versions of Xmrig and Ninjarig. Although it "works", so far haven't gotten total system hashrate higher than CPU only mining. Still experimenting...

hominoid
Posts: 437
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2
Location: Lake Superior Basin, USA
Has thanked: 39 times
Been thanked: 124 times
Contact:

Re: Hugepages - how to enable?

Post by hominoid »

I don't know HK's reason's but a valid argument could be made either way IMO. I know there have been some reports that hugepages can cause problems for a few applications. For the type of applications it benefits it probably makes more sense for server images then desktop images and I would suppose that a minimal image should probably be just that and not include unnecessary stuff. All in all, for those that need it, it's not that big of a deal to enable it IMHO. Keeps my kernel compile skills fresh. :)
Your dual mining project sounds interesting. I hope you consider posting it in the projects forum when your ready. I know I would enjoy following along and trying it out, I'm sure others would too.

elatllat
Posts: 1779
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2, C4, N2+
Has thanked: 47 times
Been thanked: 114 times
Contact:

Re: Hugepages - how to enable?

Post by elatllat »

FWIW the mainline (5.3.1) default is

Code: Select all

CONFIG_CGROUP_HUGETLB=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_HUGE_VMAP=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
and I have not seen anyone complain about issues with that.

hominoid
Posts: 437
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2
Location: Lake Superior Basin, USA
Has thanked: 39 times
Been thanked: 124 times
Contact:

Re: Hugepages - how to enable?

Post by hominoid »

That's good to hear. It will be nice to always have it available.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 1 guest