glibc Arena system_mem does not add up to the amount of VSS or RSS - linux

I have a process where I'm trying to account for where all the memory is going. My first thought was to iterate through all the arenas with gdb and output their system memory like so (I've configured the process to 32 arenas):
define arenaSizeWalk
set var $n = main_arena
set var $size = 0
set var $count = 0
while $count < 32
set var $size = $n.system_mem
set var $n = $n.next
set var $count = $count + 1
printf "%d\n", $size
end
end
However, this comes up quite short. This adds up to ~3GB. But my total memory footprint as gleaned from pmap (excluding stack guards and loaded libraries) is to the tune of 25GB.
Moreover, I used gdb-heap to dump all the memory chunks and compared them to the output from pmap
From heap all:
...
39: 0x00007fc1840c8000 -> 0x00007fc1841c8fff inuse: 1052672 bytes (<MChunkPtr chunk=0x7fc1840c8000 mem=0x7fc1840c8010 prev_size=0 IS_MMAPPED chunksize=1052672 memsize=1052656>)
40: 0x00007fc1841c9000 -> 0x00007fc184649fff inuse: 4722688 bytes (<MChunkPtr chunk=0x7fc1841c9000 mem=0x7fc1841c9010 prev_size=0 IS_MMAPPED chunksize=4722688 memsize=4722672>)
41: 0x00007fc18464a000 -> 0x00007fc18474afff inuse: 1052672 bytes (<MChunkPtr chunk=0x7fc18464a000 mem=0x7fc18464a010 prev_size=0 IS_MMAPPED chunksize=1052672 memsize=1052656>)
42: 0x00007fc1d401b000 -> 0x00007fc1d4044fff inuse: 172032 bytes (<MChunkPtr chunk=0x7fc1d401b000 mem=0x7fc1d401b010 prev_size=0 IS_MMAPPED chunksize=172032 memsize=172016>)
...
From pmap:
00007fc1840c8000 6668K rw--- [ anon ]
00007fc18474c000 1024K rw--- [ anon ]
00007fc18484d000 1024K rw--- [ anon ]
00007fc18494e000 1024K rw--- [ anon ]
00007fc184a4f000 1024K rw--- [ anon ]
00007fc184b50000 1024K rw--- [ anon ]
00007fc184c51000 1024K rw--- [ anon ]
00007fc184d52000 1024K rw--- [ anon ]
00007fc184e53000 1024K rw--- [ anon ]
00007fc184f54000 1024K rw--- [ anon ]
Chunk 42 there leaped in address space from 7fc18... -> 7fc18d. Meanwhile, we have these pmapped addresses proceeding after 07fc1840c8000 that don't seem to be accounted for with existing chunks.
I'm using glibc 2.17 under RHEL7. Am I missing something??? How can I have memory regions that don't seem to be accounted for by the system default malloc implementation? Or perhaps I've grossly misunderstood something somewheres. And how am I so short on the memory accounting?
Thanks in advance!!

I figured this out. The reason why memory regions were not traceable in this manner was because some other parts of the program were calling mmap() directly as opposed to using malloc() or new.
Only those allocations that interface with malloc will be traceable by examining the main_arena or utilizing gdb-heap.

Related

nfs mounting problem VFS: Unable to mount root fs via NFS

I am not able to mount nfs, my Parameters are like following, it is from bootlin;
setenv bootargs 'console=ttyS0,115200 root=/dev/nfs rw
nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp
ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02
g_ether.host_addr=f8:dc:7a:00:00:01'
setenv bootcmd 'mmc dev 0; devnum=${mmcdev}; setenv devtype mmc;
mmc rescan; run loadimage; run findfdt; run mmcloados'
When I am on uboot console, I called ifconfig command on host, but I couldn't see the network interface. Is it normal?
How can I determine if the mac address is correct?
when I tried to ping, I get "host is not alive" feedback.
Bootlog looks like following;
U-Boot 2021.01-ga6e7892957 (May 14 2021 - 05:06:14 +0000)
CPU : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM: 512 MiB
WDT: Started with servicing (60s timeout)
NAND: 0 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... OK
Net: eth2: ethernet#4a100000, eth3: usb_ether
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
4944384 bytes read in 325 ms (14.5 MiB/s)
65774 bytes read in 13 ms (4.8 MiB/s)
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 8ffec000, end 8ffff0ed ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.10.30-gd85aee3e19 (oe-user#oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 PREEMPT Fri May 7 18:33:44 UTC 2021
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129666
[ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02 g_ether.host_addr=f8:dc:7a:00:00:01
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 452372K/523264K available (10240K kernel code, 692K rwdata, 3336K rodata, 1024K init, 282K bss, 21740K reserved, 49152K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] Trampoline variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[ 0.000000] random: get_random_bytes called from start_kernel+0x324/0x4e0 with crng_init=0
[ 0.000000] TI gptimer clocksource: always-on /ocp/interconnect#44c00000/segment#200000/target-module#31000
[ 0.000009] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000027] clocksource: dmtimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000336] TI gptimer clockevent: 24000000 Hz at /ocp/interconnect#48000000/segment#0/target-module#40000
[ 0.001256] Console: colour dummy device 80x30
[ 0.001333] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[ 0.090406] pid_max: default: 32768 minimum: 301
[ 0.090566] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.090581] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.091421] CPU: Testing write buffer coherency: ok
[ 0.091494] CPU0: Spectre v2: using BPIALL workaround
[ 0.092291] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.092430] rcu: Hierarchical SRCU implementation.
[ 0.092519] EFI services will not be available.
[ 0.092875] devtmpfs: initialized
[ 0.102888] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.103133] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.103157] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.106522] pinctrl core: initialized pinctrl subsystem
[ 0.107450] DMI not present or invalid.
[ 0.107895] NET: Registered protocol family 16
[ 0.110073] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.127754] l3-aon-clkctrl:0000:0: failed to disable
[ 0.128925] thermal_sys: Registered thermal governor 'fair_share'
[ 0.128937] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.128952] thermal_sys: Registered thermal governor 'step_wise'
[ 0.128959] thermal_sys: Registered thermal governor 'user_space'
[ 0.129305] cpuidle: using governor ladder
[ 0.129341] cpuidle: using governor menu
[ 1.148982] No ATAGs?
[ 1.149010] hw-breakpoint: debug architecture 0x4 unsupported.
[ 1.172697] iommu: Default domain type: Translated
[ 1.174699] SCSI subsystem initialized
[ 1.175150] mc: Linux media interface: v0.10
[ 1.175194] videodev: Linux video capture interface: v2.00
[ 1.175300] pps_core: LinuxPPS API ver. 1 registered
[ 1.175309] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 1.175332] PTP clock support registered
[ 1.175391] EDAC MC: Ver: 3.0.0
[ 1.176597] Advanced Linux Sound Architecture Driver Initialized.
[ 1.177941] clocksource: Switched to clocksource dmtimer
[ 1.185160] NET: Registered protocol family 2
[ 1.186139] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 1.186177] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.186218] TCP bind hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.186258] TCP: Hash tables configured (established 4096 bind 4096)
[ 1.186373] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.186394] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.186536] NET: Registered protocol family 1
[ 1.187084] RPC: Registered named UNIX socket transport module.
[ 1.187101] RPC: Registered udp transport module.
[ 1.187108] RPC: Registered tcp transport module.
[ 1.187114] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.187132] PCI: CLS 0 bytes, default 64
[ 1.188552] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[ 1.189793] Initialise system trusted keyrings
[ 1.190087] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 1.193778] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.194528] NFS: Registering the id_resolver key type
[ 1.194578] Key type id_resolver registered
[ 1.194588] Key type id_legacy registered
[ 1.194676] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 1.194689] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[ 1.194734] ntfs: driver 2.1.32 [Flags: R/O].
[ 1.195340] Key type asymmetric registered
[ 1.195357] Asymmetric key parser 'x509' registered
[ 1.195405] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[ 1.195417] io scheduler mq-deadline registered
[ 1.195426] io scheduler kyber registered
[ 1.555186] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[ 1.652454] debugfs: Directory '49000000.dma' with parent 'dmaengine' already present!
[ 1.652500] edma 49000000.dma: TI EDMA DMA engine driver
[ 1.672358] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 1.722033] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[ 1.726383] printk: console [ttyS0] disabled
[ 1.726571] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 20, base_baud = 3000000) is a 8250
[ 2.375855] printk: console [ttyS0] enabled
[ 2.382982] omap_rng 48310000.rng: Random Number Generator ver. 20
[ 2.389283] random: fast init done
[ 2.392908] random: crng init done
[ 2.414615] brd: module loaded
[ 2.424526] loop: module loaded
[ 2.432117] libphy: Fixed MDIO Bus: probed
[ 2.497968] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 2.505680] libphy: 4a101000.mdio: probed
[ 2.512049] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[ 2.521681] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[ 2.528155] cpsw 4a100000.ethernet: ALE Table size 1024
[ 2.533505] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
[ 2.540829] cpsw 4a100000.ethernet: Detected MACID = 6c:ec:eb:ab:52:64
[ 2.549619] i2c /dev entries driver
[ 2.555585] cpuidle: enable-method property 'ti,am3352' found operations
[ 2.563165] sdhci: Secure Digital Host Controller Interface driver
[ 2.569503] sdhci: Copyright(c) Pierre Ossman
[ 2.574856] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.582911] sdhci-omap 481d8000.mmc: supply vqmmc not found, using dummy regulator
[ 2.591548] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.611739] davinci-mcasp 48038000.mcasp: IRQ common not found
[ 2.629606] NET: Registered protocol family 10
[ 2.635179] Segment Routing with IPv6
[ 2.644917] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 2.652099] NET: Registered protocol family 17
[ 2.656950] Key type dns_resolver registered
[ 2.661989] omap_voltage_late_init: Voltage driver support not added
[ 2.669321] Loading compiled-in X.509 certificates
[ 2.681322] mmc1: SDHCI controller on 481d8000.mmc [481d8000.mmc] using External DMA
[ 2.695224] OMAP GPIO hardware version 0.1
[ 2.728464] tps65217-pmic: Failed to locate of_node [id: -1]
[ 2.740405] tps65217-bl: Failed to locate of_node [id: -1]
[ 2.748809] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[ 2.755267] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 2.764284] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 2.778397] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[ 2.789190] sdhci-omap 48060000.mmc: Got CD GPIO
[ 2.794188] sdhci-omap 48060000.mmc: supply vqmmc not found, using dummy regulator
[ 2.879941] mmc0: SDHCI controller on 48060000.mmc [48060000.mmc] using External DMA
[ 2.921947] mmc0: new high speed SDHC card at address 1234
[ 2.931057] tda998x 0-0070: found TDA19988
[ 2.935744] mmcblk0: mmc0:1234 SA04G 3.68 GiB
[ 2.947658] mmcblk0: p1 p2
[ 2.951020] tilcdc 4830e000.lcdc: bound 0-0070 (ops tda998x_ops)
[ 2.962961] [drm] Initialized tilcdc 1.0.0 20121205 for 4830e000.lcdc on minor 0
[ 2.970854] tilcdc 4830e000.lcdc: [drm] Cannot find any crtc or sizes
[ 2.979434] tilcdc 4830e000.lcdc: [drm] Cannot find any crtc or sizes
[ 3.173535] mmc1: new high speed MMC card at address 0001
[ 3.180862] mmcblk1: mmc1:0001 MMC04G 3.66 GiB
[ 3.186126] mmcblk1boot0: mmc1:0001 MMC04G partition 1 1.00 MiB
[ 3.192926] mmcblk1boot1: mmc1:0001 MMC04G partition 2 1.00 MiB
[ 3.199477] mmcblk1rpmb: mmc1:0001 MMC04G partition 3 128 KiB, chardev (243:0)
[ 3.211617] mmcblk1: p1
[ 15.448539] ALSA device list:
[ 15.451579] No soundcards found.
[ 111.209007] VFS: Unable to mount root fs via NFS.
[ 111.213900] devtmpfs: mounted
[ 111.221944] Freeing unused kernel memory: 1024K
[ 111.240361] Run /sbin/init as init process
[ 111.246257] Run /etc/init as init process
[ 111.250600] Run /bin/init as init process
[ 111.254784] Run /bin/sh as init process
[ 111.259326] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 111.273591] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---
environment variables are like above;
=> printenv
addr_fit=0x90000000
arch=arm
args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
baudrate=115200
board=am335x
board_name=A335BNLT
board_rev=00C0
board_serial=5014BBBK1826
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_fdt=try
boot_fit=0
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0 legacy_mmc0 mmc1 legacy_mmc1 nand0 usb0 pxe dhcp
bootargs=console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02 g_ether.host_addr=f8:dc:7a:00:00:01
bootcmd=mmc dev 0; devnum=${mmcdev}; setenv devtype mmc; mmc rescan; run loadimage; run findfdt; run mmcloados
bootcmd_dhcp=setenv devtype dhcp; run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_legacy_mmc0=setenv mmcdev 0; setenv bootpart 0:2 ; run mmcboot
bootcmd_legacy_mmc1=setenv mmcdev 1; setenv bootpart 1:2 ; run mmcboot
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_nand=run nandboot
bootcmd_orig=if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=devnum=0; run usb_boot
bootcount=1
bootdelay=2
bootdir=/boot
bootenvfile=uEnv.txt
bootfile=zImage
bootm_size=0x10000000
bootpart=0:2
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttyO0,115200n8
cpu=armv7
dfu_alt_info_emmc=rawemmc raw 0 3751936;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x200;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1
dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x200;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
dfu_alt_info_nand=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.backup3 part 0 4;u-boot part 0 5;u-boot-spl-os part 0 6;kernel part 0 8;rootfs part 0 9
dfu_alt_info_ram=kernel ram 0x80200000 0x4000000;fdt ram 0x80f80000 0x80000;ramdisk ram 0x81000000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
dtboaddr=0x89000000
efi_dtb_prefixes=/ /dtb/ /dtb/current/
envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
eth1addr=6c:ec:eb:ab:52:66
eth2addr=6c:ec:eb:ab:52:64
eth3addr=de:ad:be:ef:00:01
ethact=usb_ether
ethaddr=6c:ec:eb:ab:52:64
fdt_addr_r=0x88000000
fdtaddr=0x88000000
fdtcontroladdr=9df41050
fdtfile=undefined
findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A335PBGL; then setenv fdtfile am335x-pocketbeagle.dtb; fi; if test $board_name = BBBW; then setenv fdtfile am335x-boneblack-wireless.dtb; fi; if test $board_name = BBG1; then setenv fdtfile am335x-bonegreen.dtb; fi; if test $board_name = BBGW; then setenv fdtfile am335x-bonegreen-wireless.dtb; fi; if test $board_name = BBBL; then setenv fdtfile am335x-boneblue.dtb; fi; if test $board_name = BBEN; then setenv fdtfile am335x-sancloud-bbe.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $board_name = A335_ICE; then setenv fdtfile am335x-icev2.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
finduuid=part uuid mmc ${bootpart} uuid
get_overlaystring=for overlay in $name_overlays;do;setenv overlaystring ${overlaystring}'#'${overlay};done;
importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
init_console=if test $board_name = A335_ICE; then setenv console ttyO3,115200n8;else setenv console ttyO0,115200n8;fi;
ipaddr=192.168.0.100
kernel_addr_r=0x82000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mmcboot=mmc dev ${mmcdev}; devnum=${mmcdev}; devtype=mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run args_mmc; if test ${boot_fit} -eq 1; then run run_fit; else run mmcloados;fi;fi;fi;
mmcdev=0
mmcloados=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcrootfstype=ext4 rootwait
mtdids=nand0=nand.0
mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
name_fit=fitImage
nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-boot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
nandrootfstype=ubifs rootwait=1
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
netloadfdt=tftp ${fdtaddr} ${fdtfile}
netloadimage=tftp ${loadaddr} ${bootfile}
nfsopts=nolock
partitions=uuid_disk=${uuid_gpt_disk};name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
pxefile_addr_r=0x80100000
ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
ramdisk_addr_r=0x88080000
ramroot=/dev/ram0 rw
ramrootfstype=ext2
rdaddr=0x88080000
rootpath=/export/rootfs
run_fit=bootm ${addr_fit}#${fdtfile}${overlaystring}
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x80000000
serial#=5014BBBK1826
serverip=192.168.0.1
soc=am33xx
spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootz ${loadaddr}
spibusno=0
spiimgsize=0x362000
spiroot=/dev/mtdblock4 rw
spirootfstype=jffs2
spisrcaddr=0xe0000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial#44e09000
stdin=serial#44e09000
stdout=serial#44e09000
update_to_fit=setenv loadaddr ${addr_fit}; setenv bootfile ${name_fit}
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usbnet_devaddr=f8:dc:7a:00:00:02
usbnet_hostaddr=f8:dc:7a:00:00:01
vendor=ti
ver=U-Boot 2021.01-ga6e7892957 (May 14 2021 - 05:06:14 +0000)
Environment size: 10427/131068 bytes
=>
I created a cfg file and added it to my kernel recipe, configuration is below. But I am still unable to achieve nfs mounting. Any suggestions?
Is there a way to make sure, may configuration changes are in the built kernel?
I have put all files, MLO, Uboot, dtb and zImage in Boot partition of the sdcard, is it correct?
CONFIG_USB_COMMON=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_MUSB_DSPS=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_AM335X_CONTROL_USB=y
CONFIG_AM335X_PHY_USB=y
CONFIG_USB_GADGET=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_ETH=y
Thank you.

.glusterfs folder is too big whereas my regular data is smaller

I'm using glusterfs 7.8 across 3 nodes. Recently we are removed bunch of data which is takes approximately 170 GB from glusterfs volume. Now our regular data sits at 1.5 GB but there is a folder named .glusterfs which haves data 177.9 Gb in the glusterfs volume. And we are running out of disk space. What is it and how can i clean it?
$ gluster volume status vlys_vol:
Status of volume: vlys_vol
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick 192.168.1.42:/mnt/kubernetes/vlys_vol 49152 0 Y 1919
Brick 192.168.1.10:/mnt/kubernetes/vlys_vol 49152 0 Y 6702
Brick 192.168.1.37:/mnt/kubernetes/vlys_vol 49152 0 Y 1054
Self-heal Daemon on localhost N/A N/A Y 1126
Self-heal Daemon on 192.168.1.10 N/A N/A Y 6714
Self-heal Daemon on ubuntu-vm1 N/A N/A Y 2021
Task Status of Volume vlys_vol
------------------------------------------------------------------------------
There are no active volume tasks
$ gluster volume status vlys_vol detail:
Status of volume: vlys_vol
------------------------------------------------------------------------------
Brick : Brick 192.168.1.42:/mnt/kubernetes/vlys_vol
TCP Port : 49152
RDMA Port : 0
Online : Y
Pid : 1919
File System : ext4
Device : /dev/vda2
Mount Options : rw,relatime,data=ordered
Inode Size : 256
Disk Space Free : 193.1GB
Total Disk Space : 617.6GB
Inode Count : 41156608
Free Inodes : 30755114
------------------------------------------------------------------------------
Brick : Brick 192.168.1.10:/mnt/kubernetes/vlys_vol
TCP Port : 49152
RDMA Port : 0
Online : Y
Pid : 6702
File System : ext4
Device : /dev/nvme0n1p2
Mount Options : rw,relatime,errors=remount-ro
Inode Size : 256
Disk Space Free : 220.7GB
Total Disk Space : 937.4GB
Inode Count : 62480384
Free Inodes : 58114459
------------------------------------------------------------------------------
Brick : Brick 192.168.1.37:/mnt/kubernetes/vlys_vol
TCP Port : 49152
RDMA Port : 0
Online : Y
Pid : 1054
File System : ext4
Device : /dev/vda2
Mount Options : rw,relatime
Inode Size : 256
Disk Space Free : 1.5TB
Total Disk Space : 2.0TB
Inode Count : 134217728
Free Inodes : 109614197
$ gluster peer status:
Number of Peers: 2
Hostname: ubuntu-vm1
Uuid: a4bc6a92-0505-4cbc-8811-e3c69714519b
State: Peer in Cluster (Connected)
Hostname: 192.168.1.37
Uuid: 01568855-feca-4e30-8ef3-8d626e0c8e6d
State: Peer in Cluster (Connected)
Here is the ncdu results:
--- /mnt/kubernetes/vlys_vol ------------------------------------------------------------
177,9 GiB [##########] /.glusterfs
1,5 GiB [ ] /vlys-test
706,8 MiB [ ] /vlys
40,0 KiB [ ] /data-redis-cluster-1
32,0 KiB [ ] /data-redis-cluster-4
32,0 KiB [ ] /data-redis-cluster-3
32,0 KiB [ ] /data-redis-cluster-2
32,0 KiB [ ] /data-redis-cluster-0
32,0 KiB [ ] /data-redis-cluster-5
24,0 KiB [ ] /vlys-test-sts-default
24,0 KiB [ ] /vlys-test-sts
e 8,0 KiB [ ] /data-redis-cluster-test-5
e 8,0 KiB [ ] /data-redis-cluster-test-4
e 8,0 KiB [ ] /data-redis-cluster-test-3
e 8,0 KiB [ ] /data-redis-cluster-test-2
e 8,0 KiB [ ] /data-redis-cluster-test-1
e 8,0 KiB [ ] /data-redis-cluster-test-0
--- /mnt/kubernetes/vlys_vol/.glusterfs -------------------------------------------------
/..
6,2 GiB [##########] /57
5,3 GiB [######## ] /22
4,6 GiB [####### ] /cd
4,5 GiB [####### ] /97
4,5 GiB [####### ] /e8
4,3 GiB [###### ] /a2
4,3 GiB [###### ] /c1
4,0 GiB [###### ] /88
3,9 GiB [###### ] /07
3,8 GiB [###### ] /66
3,7 GiB [##### ] /48
3,6 GiB [##### ] /8e
3,4 GiB [##### ] /15
3,4 GiB [##### ] /ee
3,3 GiB [##### ] /26
2,9 GiB [#### ] /aa
2,9 GiB [#### ] /52
2,9 GiB [#### ] /f3
(much more folders like this)
2,9 MiB [ ] /09
2,9 MiB [ ] /71
2,9 MiB [ ] /a4
2,8 MiB [ ] /4a
32,0 KiB [ ] /indices
e 20,0 KiB [ ] /unlink
12,0 KiB [ ] /changelogs
e 4,0 KiB [ ] /landfill
4,0 KiB [ ] health_check

Virtual address to physical address and reverse in android linux kernel

I'm trying to transform virtual address to physical address and map this physical address to virtual address with android linux kernel environment.
I can modify kernel code. So I tried next flow.
malloc() in android user space native binary not app
Transform va from malloc() to pa using the guide
Is there any API for determining the physical address from virtual address in Linux?
Pass pa to a system call function I made.
Re-map received pa to va in linux kernel space using ioremap()
Read value using readl() or ioread32()
But it's not working now.
The va to pa logic is in above link; in my native binary, below is the pseudo-code.
int main(){
char *va=malloc(100);
memset(va, "ttttt", ...)
uintptr_t paddr;
vir_to_phys_user(&paddr, getpid(), va);
syscall(sys_readpa, (unsigned long)paddr);
}
system call function
void sys_readpa(unsigned long pa){
void __iomem* mapped_add = ioremap(pa);
printk("%c", readl(mapped_add));
printk("%c", ioread32(mapped_add));
}
My code has similar logic:
I define va in user space and calculate pa from va.
I set va to "ttttt".
Pass pa to linux kernel space using syscall.
Remap this pa to va in kernel space.
Read va in kernel space and expect the value to be "ttttt"
I don't know the va to pa logic is correct. But it returns an address not failure.
But when syscall is called, kernel panic occur - e.g. "dereference for 0000000 address", and other kinds of errors. I checked pa in syscall is same with the one in user space.
My purpose of this try is study. I just wonder this implementation is possible if I can modify kernel code too but I met with an obstacle.
Please let me know what is problem or it's impossible? If needed, I'll update more detail code or specific error message.
I add detail errors and my debug log.
My user space log
: vitrual address : 0xf079c000
: 0xf079c000 -> 0xa4a8a000
I pass 0xa4a8a000 to syscall.
dmesg
[ 96.794448] accepted pa : 00000000a4a8a000
[ 96.794473] ------------[ cut here ]------------
[ 96.794500] WARNING: CPU: 6 PID: 11644 at arch/arm64/mm/ioremap.c:58 __ioremap_caller+0xc0/0xcc
[ 96.794519] Modules linked in:
[ 96.794552] CPU: 6 PID: 11644 Comm: mt Not tainted 4.14.113 #1
[ 96.794590] Call trace:
[ 96.794611] [<0000000000000000>] dump_backtrace+0x0/0x2b8
[ 96.794632] [<0000000000000000>] show_stack+0x18/0x24
[ 96.794655] [<0000000000000000>] dump_stack+0xa0/0xdc
[ 96.794676] [<0000000000000000>] __warn+0xbc/0x164
[ 96.794695] [<0000000000000000>] report_bug+0xac/0xdc
[ 96.794713] [<0000000000000000>] bug_handler+0x30/0x8c
[ 96.794732] [<0000000000000000>] brk_handler+0x94/0x150
[ 96.794751] [<0000000000000000>] do_debug_exception+0xd4/0x170
[ 96.794769] Exception stack(0xffffff8010fdbc10 to 0xffffff8010fdbd50)
[ 96.794787] bc00: 0000000000000000 0000000000000004
[ 96.794805] bc20: 00e8000000000f07 ffffff8008358714 000000000000000c 0000000000002d7c
[ 96.794822] bc40: ffffffc0119630e7 5b20205d38343434 0000000000000000 0000000000000001
[ 96.794839] bc60: 0000000000000001 00000000bab00000 0000000000000000 0000000080000000
[ 96.794856] bc80: ffffff800b18d000 0000000000000082 00000000000564c8 0000000000000074
[ 96.794873] bca0: 0000000000000074 00e8000000000f07 00000000a4a8a000 0000000000001000
[ 96.794890] bcc0: ffffff8008358714 0000000000000000 0000000000000011 000000000000018f
[ 96.794908] bce0: 000000000000018e ffffff8009316000 ffffffc8767edf80 ffffff8010fdbe80
[ 96.794926] bd00: ffffff80081fe124 ffffff8010fdbe50 ffffff80081fe188 0000000020400145
[ 96.794943] bd20: 0000000000000034 7cebe7b2cf849500 0000007fffffffff ffffff8009316000
[ 96.794961] bd40: ffffff8010fdbe80 ffffff80081fe188
[ 96.794978] [<0000000000000000>] el1_dbg+0x18/0x74
[ 96.794995] [<0000000000000000>] __ioremap_caller+0xc0/0xcc
[ 96.795014] [<0000000000000000>] __ioremap+0x10/0x1c
[ 96.795035] [<0000000000000000>] sys_readpa+0x78/0xfc
[ 96.795055] Exception stack(0xffffff8010fdbec0 to 0xffffff8010fdc000)
[ 96.795072] bec0: 00000000a4a8a000 0000000028bf4d08 0000000000000003 00000000f079c000
[ 96.795090] bee0: 0000000000000000 00000000a4a8a000 0000000000000000 000000000000018e
[ 96.795107] bf00: 00000000f09afd94 00000000f09d2b99 00000000ae6c9e84 00000000ae6a261e
[ 96.795124] bf20: 00000000ff921bf0 00000000ff921be0 00000000ae5f7b27 0000000000000000
[ 96.795142] bf40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 96.795159] bf60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 96.795176] bf80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 96.795195] bfa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 96.795212] bfc0: 00000000f091ce20 0000000060000010 00000000a4a8a000 000000000000018e
[ 96.795229] bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 96.795247] [<0000000000000000>] __sys_trace_return+0x0/0x4
[ 96.795265] ---[ end trace 91e76f3be7c0b9bd ]---
[ 96.795418] ioremap return null
I found fix.
ioremap have a check logic for validation of address.
This function is for reserved address but it tring to map address that's already mapped to a process.
So, I modify the check logic in ioreamp and it works well.

address mapping from one process to another in Linux

Can this be done? Process A does x = malloc(...). x is the virtual address from process A's address space (heap). I want a system call, which takes x and unmap's it from process A's address space, and maps it to the virtual address space of process B.
Would virt_to_phys() and phys_to_virt() work? virt_to_phys() would be done in process A's context and phys_to_virt() in process B's context. Am I making any sense? I did not dive deeply into address mapping mechanisms in the Linux kernel.
You can do this using POSIX shared memory
Process 1
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
int main()
{
unsigned char *shared_byte;
int shmfd = shm_open("/test_object", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
ftruncate(shmfd, 1);
shared_byte = mmap(NULL, 1, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0);
*shared_byte = 123;
for(;;);
}
Compile and run:
$ cc proc1.c -o proc1 -lrt
$ ./proc1 &
[1] 5381
Inspect the process map:
$ pmap 5381
5381: ./proc1
08048000 4K r-x-- proc1
08049000 4K rw--- proc1
b7540000 8K rw--- [ anon ]
b7542000 100K r-x-- libpthread-2.22.so
b755b000 4K r---- libpthread-2.22.so
b755c000 4K rw--- libpthread-2.22.so
b755d000 8K rw--- [ anon ]
b755f000 1728K r-x-- libc-2.22.so
b770f000 4K ----- libc-2.22.so
b7710000 8K r---- libc-2.22.so
b7712000 4K rw--- libc-2.22.so
b7713000 12K rw--- [ anon ]
b7716000 28K r-x-- librt-2.22.so
b771d000 4K r---- librt-2.22.so
b771e000 4K rw--- librt-2.22.so
b7724000 4K rw-s- test_object
b7725000 4K rw--- [ anon ]
b7726000 8K r---- [ anon ]
b7728000 4K r-x-- [ anon ]
b7729000 136K r-x-- ld-2.22.so
b774b000 4K r---- ld-2.22.so
b774c000 4K rw--- ld-2.22.so
bfe7f000 132K rw--- [ stack ]
total 2220K
Notice that there is a 4k test_object mapped to the virtual address space of process 1.
Process 2
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
unsigned char *shared_byte;
int shmfd = shm_open("/test_object", O_RDONLY, 0);
shared_byte = mmap(NULL, 1, PROT_READ, MAP_SHARED, shmfd, 0);
printf("%d\n", *shared_byte);
for(;;);
}
Compile and run:
$ cc proc2.c -o proc2 -lrt
$ ./proc2 &
[2] 5397
123
Notice the "123" value is there from the first program.
Inspect the process map:
$ pmap 5397
5397: ./proc2
08048000 4K r-x-- proc2
08049000 4K rw--- proc2
b7555000 8K rw--- [ anon ]
b7557000 100K r-x-- libpthread-2.22.so
b7570000 4K r---- libpthread-2.22.so
b7571000 4K rw--- libpthread-2.22.so
b7572000 8K rw--- [ anon ]
b7574000 1728K r-x-- libc-2.22.so
b7724000 4K ----- libc-2.22.so
b7725000 8K r---- libc-2.22.so
b7727000 4K rw--- libc-2.22.so
b7728000 12K rw--- [ anon ]
b772b000 28K r-x-- librt-2.22.so
b7732000 4K r---- librt-2.22.so
b7733000 4K rw--- librt-2.22.so
b7738000 4K rw--- [ anon ]
b7739000 4K r--s- test_object
b773a000 4K rw--- [ anon ]
b773b000 8K r---- [ anon ]
b773d000 4K r-x-- [ anon ]
b773e000 136K r-x-- ld-2.22.so
b7760000 4K r---- ld-2.22.so
b7761000 4K rw--- ld-2.22.so
bffbf000 132K rw--- [ stack ]
total 2224K
Notice that there is a 4k test_object mapped to the virtual address space of process 2.
Cleanup
$ killall proc1
[1]- Terminated ./proc1
$ killall proc2
[2]+ Terminated ./proc2
$ cat > clean.c << EOF
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
shm_unlink("/test_object");
}
EOF
$ cc clean.c -o clean -lrt
$ ./clean

virtual memory size is much larger than RES, although there are no mapped files

The program has much large virtual memory than it's in ram, there is no swapping, since there is a lot of free space in ram. I looked at file descriptors, and there are no large files. This is part of process map:
107 00007f97f8021000 65404K ----- [ anon ]
108 00007f97fc000000 2052K rw--- [ anon ]
109 00007f97fc201000 63484K ----- [ anon ]
110 00007f9800000000 272K rw--- [ anon ]
111 00007f9800044000 65264K ----- [ anon ]
112 00007f98043fa000 4K ----- [ anon ]
113 00007f98043fb000 10240K rw--- [ anon ]
There are a lot of regions with about 64Kb. If they are allocated in my program, why then ram is only 250mb and virtual 3gb? What means anon?

Resources