Memory fragmentation in a Linux settop box


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Memory fragmentation in a Linux settop box
# 8  
Old 07-09-2014
You use direct IO on Linux by calling open() with the O_DIRECT flag. The buffers used for read()/write() calls might need to have a specific alignment, most likely page-aligned, see the man pages for valloc() and memalign(). Also, both the number of bytes transferred by each read()/write() call and the offset read from/written to might also need to be an exact multiple of a fundamental filesystem or hardware block size. That could cause problems reading/writing the last block of a file, depending on the version of Linux you have, the file system you're using, and even maybe your hardware.
# 9  
Old 07-10-2014
Quote:
Originally Posted by jim mcnamara
Does your app request physically contiguous pages of heap memory for cache? - Oracle does that. This triggers the onset of heap (memory) fragmentation especially quickly
I can see why it would cause issues when contiguous pages aren't available, but why using contiguous pages cause pages to become discontinuous?
# 10  
Old 07-10-2014
Quote:
Originally Posted by Corona688
I can see why it would cause issues when contiguous pages aren't available, but why using contiguous pages cause pages to become discontinuous?
Oracle doesn't technically request "contiguous" pages, it requests large pages. To get those large pages, the OS must coalesce smaller pages.

Oracle uses the large page, releases it, then something else requests normal size pages and the large page gets fragmented. Oracle comes back and requests larges pages...

Rinse, lather, repeat.

The coalescing necessary to create the large pages can have some nasty performance impacts as it tends to lock up virtual memory management while it's happening. And for any OS instance, VM management tends to get very single threaded when memory gets tight. Processes won't start or hang because fork() and brk() calls block while the virtual memory manager thrashes about.

This can be really bad with Oracle on Solaris using ZFS because the ZFS ARC cache uses lots of small pages and isn't exactly quick in letting them go, and the standard recommendation is "let the ARC cache get as big as it wants, it doesn't hurt anything." Umm, wrong.
This User Gave Thanks to achenle For This Post:
# 11  
Old 07-10-2014
Wonderful explanation, thank you.
# 12  
Old 07-11-2014
I had ZFS ARC 'issues' on Oracle database machines (database using ASM).

Since there is alot of free memory, ZFS eats most of it. Then application start to attack the database causing significant rise of PGA.

Altho the ZFS holds alot of GB, it is slow to release, and the machine starts swapping causing everything to come to a almost halt.

I resolved by lowering ARC cache max to 4 GB on every database machine.
These are LDOMs on Solaris 11.1 T5 Sparc machines.

Regards
Peasant.
# 13  
Old 09-13-2014
You can also look at changing the kern parmetere vm.swappiness.

They best this is to have enough memory, so you don't swap. If have enough memory (lots), you can look at vm.nr_hugepages to improve system performane, so it doesn't have to scan through as many pages. It all depends on the applications and whatelse you are running.
# 14  
Old 09-17-2014
Yes, I have enough memory (typ. ~400MB "MemAvailable" used for caches, with ~6MB really free, and no swap required or ever used), so I will look into "hugepages", thanks.

But I'm wondering whether my understanding of the problem was maybe wrong all the time. When the "page allocation failure" is reported (see the log in post #1 and the one below), what does this mean?:

Code:
Jul  1 23:31:47 gbquad user.warn kernel: enigma2: page allocation failure: order:4, mode:0xd0
Jul  1 23:31:47 gbquad user.err kernel: Call Trace:
Jul  1 23:31:47 gbquad user.err kernel: [<806092f8>] dump_stack+0x8/0x34
Jul  1 23:31:47 gbquad user.err kernel: [<8008b60c>] warn_alloc_failed+0xe4/0x124
Jul  1 23:31:47 gbquad user.err kernel: [<8008dcc4>] __alloc_pages_nodemask+0x448/0x6e0
Jul  1 23:31:47 gbquad user.err kernel: [<800beb60>] cache_alloc_refill+0x390/0x65c
Jul  1 23:31:47 gbquad user.err kernel: [<800bf004>] __kmalloc+0x108/0x130
Jul  1 23:31:47 gbquad user.err kernel: [<8009ecd0>] memdup_user+0x24/0x94
Jul  1 23:31:47 gbquad user.err kernel: [<80488218>] dvbdmx_write+0x44/0xd8
Jul  1 23:31:47 gbquad user.err kernel: [<e1125910>] dev_dmx_demux_write_hook+0xc0/0xec [dvb]
Jul  1 23:31:47 gbquad user.err kernel: [<e1125c50>] dev_dmx_dvr_write_hook+0x15c/0x190 [dvb]
Jul  1 23:31:47 gbquad user.err kernel: [<800c29dc>] vfs_write+0x9c/0x184
Jul  1 23:31:47 gbquad user.err kernel: [<800c2e04>] sys_write+0x50/0xb0
Jul  1 23:31:47 gbquad user.err kernel: [<8000d8e8>] stack_done+0x20/0x44
Jul  1 23:31:47 gbquad user.err kernel: Mem-Info:
Jul  1 23:31:47 gbquad user.err kernel: Normal per-cpu:
Jul  1 23:31:47 gbquad user.err kernel: CPU    0: hi:  186, btch:  31 usd:   0
Jul  1 23:31:47 gbquad user.err kernel: CPU    1: hi:  186, btch:  31 usd:  11
Jul  1 23:31:48 gbquad user.err kernel: active_anon:17978 inactive_anon:48 isolated_anon:0
Jul  1 23:31:48 gbquad user.err kernel:  active_file:54255 inactive_file:55640 isolated_file:0
Jul  1 23:31:48 gbquad user.err kernel:  unevictable:0 dirty:1955 writeback:0 unstable:0
Jul  1 23:31:48 gbquad user.err kernel:  free:1490 slab_reclaimable:1770 slab_unreclaimable:3355
Jul  1 23:31:48 gbquad user.err kernel:  mapped:2828 shmem:80 pagetables:116 bounce:0
Jul  1 23:31:48 gbquad user.err kernel: Normal free:5712kB min:4072kB low:5088kB high:6108kB \
    active_anon:71912kB inactive_anon:192kB active_file:217020kB inactive_file:222832kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:1038336kB mlocked:0kB dirty:
Jul  1 23:31:48 gbquad user.err kernel: lowmem_reserve[]: 0 0
Jul  1 23:31:48 gbquad user.err kernel: Normal: 716*4kB 298*8kB 38*16kB 3*32kB 4*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 6208kB
Jul  1 23:31:48 gbquad user.err kernel: 109816 total pagecache pages
Jul  1 23:31:48 gbquad user.err kernel: 0 pages in swap cache
Jul  1 23:31:48 gbquad user.err kernel: Swap cache stats: add 0, delete 0, find 0/0
Jul  1 23:31:48 gbquad user.err kernel: Free swap  = 0kB
Jul  1 23:31:48 gbquad user.err kernel: Total swap = 0kB
Jul  1 23:31:48 gbquad user.err kernel: 327680 pages RAM
Jul  1 23:31:48 gbquad user.err kernel: 184924 pages reserved
Jul  1 23:31:48 gbquad user.err kernel: 19064 pages shared
Jul  1 23:31:48 gbquad user.err kernel: 123681 pages non-shared

(a) No contiguous 128k block is available in the "really free" 6MB, but such block will then be freed up within the 400MB "MemAvailable" automatically by dropping caches, thus the block can be allocated in the end, but the time required for this is resulting in a dropout and the artefacts in the video stream.

(b) No contiguous 128k block is available at all, neither in the "really free" 6BM nor in the 400MB "MemAvailable", but can be made available by "memory compaction" (again, time required resulting in the artefacts in the video stream).

(c) No contiguous 128k block is available at all and cannot be made available, not even by "memory compaction", as the whole ~400MB memory is really badly fragmented with blocked small blocks all over, so that the failure of allocating a 128k block is a permanent one, and the missing block is causing the dropout in the video stream.

Is anyone able to answer this reliably, or is any additional information from side is required?

Last edited by Fischreiher; 09-17-2014 at 06:33 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Copying , renaming the file from windox box and ftp to Linux box

Hello my dear friends, Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory. is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Discussion started by: umesh yadav
1 Replies

2. Red Hat

How to access redhat Linux box graphically from windows box?

Hi I have a linux box and need to access from windows graphically # uname -a Linux pc-l416116 2.6.18-155.el5 #1 SMP Fri Jun 19 17:06:47 EDT 2009 i686 i686 i386 GNU/Linux What components do I need to install on Linux and windows to do that? TIA (6 Replies)
Discussion started by: magnus29
6 Replies

3. UNIX for Dummies Questions & Answers

Mounting Linux box to Linux box

Hi, I've been able to mount my linux box to a windows machine, but I can't seem to mount my linux box to another linux box I have. (I know I could scp, but for other reasons I need to do it this way) Samba is installed. Here is an example where I mount to a Win machine.--> works fine mount... (12 Replies)
Discussion started by: jdilts
12 Replies

4. Solaris

Memory issue on solaris10 box

my system has 128G of installed memory. top, vmstat shows the system has just over 10G of free memory on the system. but as per prstat o/p the usage is just 50-55G is there anyway i can find which process/zone is using more memory ? System has 3 zones and all running application servers. ... (1 Reply)
Discussion started by: fugitive
1 Replies

5. Solaris

Memory of box

I have certain questions. 1) How can i see the memory of the unix box. 2) How can i see the size of the database on the box 3)can anyone suggest an article or tutorial that explains the concept of file systems and mount point in UNIX. 4)How can i see the dblink on the server I... (5 Replies)
Discussion started by: asalman.qazi
5 Replies

6. Linux

my box can't see full memory

Hi I'be recently installed Virtouzzo on Centos 5 on 16GB box , but the system could only see 4 GB of RAM, I installed the package kernel-PAE, but the virtuozzo kernel still can't see the full memory. even the kernel system can see 16GB of RAM is there any idea bout that ? Thanks (2 Replies)
Discussion started by: Raied
2 Replies

7. HP-UX

help me decipher how much memory on my box

hi, if I do top, I get Memory: 19277012K (5868296K) real, 33860312K (11294208K) virtual, 795392K free If I do swapinfo -tm I get: % swapinfo -tm Mb Mb Mb PCT TYPE AVAIL USED FREE USED dev 16384 0 16383 0% dev ... (3 Replies)
Discussion started by: JamesByars
3 Replies

8. Shell Programming and Scripting

Script to Reboot a linux box from a windows box

HI All, I need a script to reboot a linux box from a windows box. The script needs to run automatically whenever a sitescope alerts with an error message. Have searched for this in the forums, but could not get something relative. Pls. let me know the various alternatives we have to do... (2 Replies)
Discussion started by: Crazy_murli
2 Replies

9. UNIX for Dummies Questions & Answers

Fragmentation command in linux?

Hi, Please let me know more details on fragmentation in redhat linux and command to check fragmented files? Thanks, Bache Gowda (2 Replies)
Discussion started by: bache_gowda
2 Replies

10. Filesystems, Disks and Memory

Memory usage in the box

Hello: Environment is: Oracle 817 on IBM RS/6000 AIX 433 I have 4GB RAM on the box and Page/Swap is about the same. Presently I am using close to 1GB of RAM towards 5 instances of ORACLE production environments. How can I know, how much of memory/RAM is used for : Oracle Processes , I... (2 Replies)
Discussion started by: ST2000
2 Replies
Login or Register to Ask a Question