Questions tagged [huge-pages]

Hugepages is a mechanism that allows the Linux kernel to utilize the multiple page size capabilities of modern hardware architectures.

Hugepages is a mechanism that allows the Linux kernel to utilize the multiple page size capabilities of modern hardware architectures. Linux uses pages as the basic unit of memory, where physical memory is partitioned and accessed using the basic page unit. The default page size is 4096 Bytes in the x86 architecture. Hugepages allows large amounts of memory to be utilized with a reduced overhead. Linux uses “Transaction Lookaside Buffers” (TLB) in the CPU architecture. These buffers contain mappings of virtual memory to actual physical memory addresses. So utilizing a huge amount of physical memory with the default page size consumes the TLB and adds processing overhead.

The Linux kernel is able to set aside a portion of physical memory to be able be addressed using a larger page size. Since the page size is higher, there will be less overhead managing the pages with the TLB. In the Linux 2.6 series of kernels, hugepages is enabled using the CONFIG_HUGETLB_PAGE feature when the kernel is built. Systems with large amount of memory can be configured to utilize the memory more efficiently by setting aside a portion dedicated for hugepages. The actual size of the page is dependent on the system architecture.

Source: http://linux.cloudibee.com/2007/09/linux-hugepages/

188 questions
28
votes
1 answer

c++ application fails allocating more hugepages than a certain limit

Overview I have a c++ application that reads large amount of data (~1T). I run it using hugepages (614400 pages at 2M) and this works - until it hits 128G. For testing I created a simple application in c++ that allocates chunks of 2M until it…
27
votes
2 answers

Using mmap and madvise for huge pages

I want to allocate memory on the hugepages being used by a Linux machine. I see that there are two ways to do this, using mmap and madvise. That is, using the MAP_HUGETLB flag with the mmap call - base_ptr_ = mmap(NULL, memory_size_, PROT_READ |…
ssb
  • 7,422
  • 10
  • 36
  • 61
26
votes
2 answers

Solving Redis warnings on overcommit_memory and Transparent Huge Pages for Ubuntu 16.04 on EC2

On a fresh Ubuntu 16.04 EC2 instance the warnings appear like so: WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run…
legel
  • 2,507
  • 3
  • 23
  • 22
18
votes
2 answers

Java periodically hangs at futex and very low IO output

Currently my application periodically blocked in IO , and the output is very low . I use some command to trace the process. By using jstack i found that the app is hanging at FileOutputStream.writeBytes. By using strace -f -c -p pid to collect…
bforevdr
  • 271
  • 1
  • 2
  • 5
16
votes
1 answer

Advising Prolog processor to utilize huge-pages

Are there any Prolog implementations which support utilizing huge-pages (2MB/4MB per memory page) instead of the vanilla 4Kb memory pages. Ideally, I would like to declare to the interpreter/compiler/run-time that it's okay to use X huge-pages for…
repeat
  • 18,496
  • 4
  • 54
  • 166
12
votes
1 answer

Multiple hugepage sizes in Linux (x86-64)?

Does the Linux on x86-64 support multiple huge page sizes (e.g., both 2MB and 1GB page sizes beyond the 4KB base page size)? If yes, is there a way to specify that for a given allocation which huge page size to use? In other words, my question is if…
Arka
  • 955
  • 2
  • 12
  • 21
11
votes
1 answer

Why does `change_protection` hog CPU while loading a large amount of data into RAM?

We have built an in-memory database, which eats about 100-150G RAM in a single Vec, which is populated like this: let mut result = Vec::with_capacity(a_very_large_number); while let Ok(n) = reader.read(&mut buffer) { result.push(...); } perf…
Dapeng
  • 1,704
  • 13
  • 25
11
votes
5 answers

How to release hugepages from the crashed application

I have an application that uses hugepage and the application suddenly crashed due to some bug. After crashing, since the application does not release the hugepage properly, the free hugepage number is not increased in sys filesystem. $ sudo cat…
jaeyong
  • 8,951
  • 14
  • 50
  • 63
10
votes
3 answers

How do I enable transparent huge pages by default on Ubuntu?

How do I enable transparent huge pages by default on Ubuntu? ~$ uname -a Linux yoda 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux ~$ cd…
Daniel
  • 1,861
  • 1
  • 16
  • 24
10
votes
1 answer

Cannot create JVM with -XX:+UseLargePages enabled

I have a Java service that currently runs with a 14GB heap. I am keen to try out the -XX:+UseLargePages option to see how this might affect the performance of the system. I have configured the OS as described by Oracle using appropriate shared…
teabot
  • 15,358
  • 11
  • 64
  • 79
8
votes
3 answers

Pod fails to allocate hugepages in kubernetes

I'm running a pod in kubernetes, with hugepages allocated in host and hugepages defined in the pod. The kubernetes worker is in a VM. The VM (host) has huge pages allocated. The pod fails to allocate hugepages though. Application gets SIGBUS when…
emartin
  • 81
  • 1
  • 4
8
votes
3 answers

php-fpm7.1 mmap/munmap (very) slow performance on virtualized systems (hugepage)

My php-fpm process is facing performance issues on Ubuntu 14.04 LTS (Nginx server, MariaDB database). strace -f $(pidof php-fpm7.1 | sed 's/\([0-9]*\)/\-p \1/g') Gave me <... epoll_wait resumed> {}, 1, 1000) = 0 [pid 32533] epoll_wait(8, {}, 1,…
Etienne Gautier
  • 2,901
  • 4
  • 26
  • 35
8
votes
3 answers

How do I allocate a DMA buffer backed by 1GB HugePages in a linux kernel module?

I'm trying to allocate a DMA buffer for a HPC workload. It requires 64GB of buffer space. In between computation, some data is offloaded to a PCIe card. Rather than copy data into a bunch of dinky 4MB buffers given by pci_alloc_consistent, I would…
muusbolla
  • 637
  • 7
  • 20
8
votes
1 answer

1GB pages and Transparent Huge Pages (Linux)

The Transparent Huge Pages(THP) support in recent Linux kernels allows automatic promotion/demotion between different page sizes (e.g., 4KB and 2MB in x86-64). But I am not sure if THP can also promote/demote page sizes between 4KB and 1GB pages or…
Arka
  • 955
  • 2
  • 12
  • 21
7
votes
1 answer

How to load .text segments of shared libraries into huge pages on linux

I'm trying to use huge pages for .text segments of my application to reduce TLB misses. I successfully relinked my app with libhugetlbfs support and .text segment of main executable is now being loaded in huge page backed memory. However main code…
Andrey Ivanov
  • 321
  • 1
  • 4
1
2 3
12 13