Huge Pages memory usage seems to be high in Ubuntu 16.04 LTS

Asked by Lakshminarayanan Seshadri

Recently moved to Ubuntu 16.04 LTS desktop release from 14.04 . Ever since i moved on my laptop with just few gnome terminals and firefox browser i see huge pages memory i.e AnonHugePages seem to be high .
i switched from Unity(default) to gnome classic (metacity) to check if memory usage comes down but out of box it seems to be high.

In particular for a simple calculator process from its /proc/<pid>/smaps file i see "AnonHugePages" is high (when i sum it up) .
Ordinary Anonymous pages (4K size pages) total usage for above calculator shows 37.5MB as well as
AnonHugePages also show equal usage of around 34MB.

i see same normal page size Anonymous memory usage and AnonHugePage memory usage as reported by "pmap -XX" for calculator process.

i ask this question because out of box the overall AnonHugePages comes >300M and seems to be high unless i miss something here.

Can anyone clarify above issue. (One can check AnonPages total and AnonHugePages total from /proc/meminfo reported by Kernel.

Question information

Language:
English Edit question
Status:
Open
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

free -m; top -n 1

Thanks

Revision history for this message
Lakshminarayanan Seshadri (lnarayanan-seshadri) said :
#2

Thanks for response.

I provide all related details as much as possible here:

uname -a
--------------
 > 4.10.0-38-generic #42~16.04.1-Ubuntu SMP (64bit desktop, updated to latest)

free -m
-------------------
> total used free shared buff/cache available
Mem: 7850 1556 5018 145 1274 5846
Swap: 8191 0 8191

(note: i have 8GB RAM (i.e 7850 total above after some video memory taken) and available reported by kernel as above is 5846MB.
This means usage is around 2004MB out of which as expected Anon usage comes to around 1038MB along with AnonHugePages as reported in /proc/meminfo is >300M )

/proc/meminfo
---------------------------
AnonPages: 1065428 kB
AnonHugePages: 395264 kB ---> This is the issue i am talking (>300M)

top -n 1
-------------
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.4 us, 0.9 sy, 0.0 ni, 94.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 8038736 total, 5113476 free, 1619920 used, 1305340 buff/cache
KiB Swap: 8388604 total, 8388604 free, 0 used. 5960632 avail Mem

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15379 slnaray+ 20 0 2399964 389396 143240 S 13.3 4.8 100:20.02 Web Content
  955 root 20 0 425180 101296 74644 S 6.7 1.3 33:19.86 Xorg
    1 root 20 0 185416 5980 3916 S 0.0 0.1 0:04.92 systemd
    2 root 20 0 0 0 0 S 0.0 0.0 0:00.05 kthreadd
    4 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
    6 root 20 0 0 0 0 S 0.0 0.0 0:00.54 ksoftirqd/0
    7 root 20 0 0 0 0 S 0.0 0.0 0:57.40 rcu_sched
    8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
    9 root rt 0 0 0 0 S 0.0 0.0 0:00.06 migration/0
   10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-drain
   11 root rt 0 0 0 0 S 0.0 0.0 0:00.88 watchdog/0
   12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
   13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
   14 root rt 0 0 0 0 S 0.0 0.0 0:00.83 watchdog/1
   15 root rt 0 0 0 0 S 0.0 0.0 0:00.05 migration/1
   16 root 20 0 0 0 0 S 0.0 0.0 0:00.73 ksoftirqd/1
   18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
   19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/2
   20 root rt 0 0 0 0 S 0.0 0.0 0:00.83 watchdog/2
   21 root rt 0 0 0 0 S 0.0 0.0 0:00.06 migration/2
   22 root 20 0 0 0 0 S 0.0 0.0 0:01.75 ksoftirqd/2
   24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/2:0H
   25 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/3
   26 root rt 0 0 0 0 S 0.0 0.0 0:00.82 watchdog/3
   27 root rt 0 0 0 0 S 0.0 0.0 0:00.06 migration/3
   28 root 20 0 0 0 0 S 0.0 0.0 0:01.71 ksoftirqd/3
   30 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/3:0H
   31 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
   32 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
   34 root 20 0 0 0 0 S 0.0 0.0 0:00.38 khungtaskd
   35 root 20 0 0 0 0 S 0.0 0.0 0:00.00 oom_reaper
   36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback

i simply have firefox 56 out of box browser in Ubuntu with 4 tabs open, 2 gnome terminals and a simple calculator.
that;s all i run but "AnonHugePages" total >300M seem to be high.

Revision history for this message
Lakshminarayanan Seshadri (lnarayanan-seshadri) said :
#3

I also add that i don't suffer any memory exhaustion or performance issue as such but i am worried about HugePages memory usage unnecessarily or rather unusually high on a simple usage case.
i can run some more apps/tests to see if it grows much higher and can update more info.
As of now you can check above info i had given to see if something you also do see abnormal/other here.

thanks

Revision history for this message
Lakshminarayanan Seshadri (lnarayanan-seshadri) said :
#4

i think Transparent Huge Pages feature in kernel is what i see here. i read i can disable in ubuntu if needed for my usecase.
closing it.

Revision history for this message
Lakshminarayanan Seshadri (lnarayanan-seshadri) said :
#5

i would like to know if there would be a fix for the linked bug which changes Transparent Huge Pages feature in Ubuntu Kernel to "madvise" and not "enabled" by default.
Currently it is "enabled" in 16.04 LRS Ubuntu latest kernel.
Can someone from respective area advise here.

Revision history for this message
Lakshminarayanan Seshadri (lnarayanan-seshadri) said :
#6

cat /sys/kernel/mm/transparent_hugepage/enabled
>>[always] madvise never

i am keeping open as from above i can see it is still "always" and not "madvise".
Issue is tracking THP feature allocation becomes difficult for my testcase and really difficult to track leak related tests .
It is better as stated in bug to make it "madvise" by default which would help.

thx

Can you help with this problem?

Provide an answer of your own, or ask Lakshminarayanan Seshadri for more information if necessary.

To post a message you must log in.