<commit_before># Hugepages support in PF_RING ZC

Hugepages are used by ZC for buffers allocations. This document describes 
how to enable them into your system. 

## For the impatient
```
echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
mount -t hugetlbfs nodev /dev/hugepages
```

## The whole story
Linux typically use memory pages of 4 KBytes, but provides an explicit 
interface to allocate pages with bigger size called hugepages. It is up 
to developers/administrators to decide when they have to be used. 

Hugepages advantages:

- large amounts of physical memory can be reserved for memory allocation, 
  that otherwise would fail especially when physically contiguous memory 
  is required.

- reduced overhead: as the TLB (Translation Lookaside Buffer) contains 
  per-page virtual to physical address mappings, using a large amount of
  memory with the default page size leads to processing overhead for 
  managing the TLB entries.

The default hugepage size is usually 2 MBytes. The hugepage size can be 
found in /proc/meminfo:
<commit_msg>Added small note for the impatient about exceeding RAM.<commit_after># Hugepages support in PF_RING ZC

Hugepages are used by ZC for buffers allocations. This document describes 
how to enable them into your system. 

## For the impatient
```
echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages # 1024*2048kB = ~2.1 GB
mount -t hugetlbfs nodev /dev/hugepages
```

_Warning: If you accidentally exceed the amount of available RAM, the kernel will round down to the highest number of hugepages possible and grind your system to a halt._

## The whole story
Linux typically use memory pages of 4 KBytes, but provides an explicit 
interface to allocate pages with bigger size called hugepages. It is up 
to developers/administrators to decide when they have to be used. 

Hugepages advantages:

- large amounts of physical memory can be reserved for memory allocation, 
  that otherwise would fail especially when physically contiguous memory 
  is required.

- reduced overhead: as the TLB (Translation Lookaside Buffer) contains 
  per-page virtual to physical address mappings, using a large amount of
  memory with the default page size leads to processing overhead for 
  managing the TLB entries.

The default hugepage size is usually 2 MBytes. The hugepage size can be 
found in /proc/meminfo:

{'fraction_non_alphanumeric': 0.04233025984911987, 'fraction_numerical': 0.012573344509639563, 'mean_word_length': 4.246153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7623580', 'n_tokens_mistral': 673, 'n_tokens_neox': 614, 'n_words': 334}