如题,按理说芯片可用RAM总大小是32M,出去uboot和kernel及文件系统所占用空间,应该预留个20M没问题啊,但现在怎么设置都是在16M左右徘徊,求解。
离线
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@ubuntu) (gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-6ubuntu1)) #6 Tue Jun 4 23:59:57 PDT 2019
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] random: fast init done
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Memory: 23752K/32768K available (5120K kernel code, 211K rwdata, 1140K rodata, 1024K init, 219K bss, 9016K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc2800000 - 0xff800000 ( 976 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (6112 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 212 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 220 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000038] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000085] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000483] Console: colour dummy device 80x30
[ 0.000558] Calibrating delay loop... 395.67 BogoMIPS (lpj=1978368)
[ 0.120220] pid_max: default: 32768 minimum: 301
[ 0.120442] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.120470] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.121528] CPU: Testing write buffer coherency: ok
[ 0.122961] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.124745] devtmpfs: initialized
[ 0.128738] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.128791] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.129003] pinctrl core: initialized pinctrl subsystem
[ 0.130677] NET: Registered protocol family 16
[ 0.131646] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.132880] cpuidle: using governor menu
[ 0.147066] SCSI subsystem initialized
[ 0.147314] usbcore: registered new interface driver usbfs
[ 0.147420] usbcore: registered new interface driver hub
[ 0.147573] usbcore: registered new device driver usb
[ 0.147935] pps_core: LinuxPPS API ver. 1 registered
[ 0.147954] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.147998] PTP clock support registered
[ 0.149078] clocksource: Switched to clocksource timer
[ 0.170437] NET: Registered protocol family 1
[ 0.170785] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.172114] Initialise system trusted keyrings
[ 0.172596] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[ 0.181557] jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
[ 0.192384] Key type asymmetric registered
[ 0.192418] Asymmetric key parser 'x509' registered
[ 0.192616] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.192644] io scheduler noop registered
[ 0.192657] io scheduler deadline registered
[ 0.193214] io scheduler cfq registered (default)
[ 0.193243] io scheduler mq-deadline registered
[ 0.193255] io scheduler kyber registered
[ 0.194038] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.200523] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.338478] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.343819] console [ttyS0] disabled
[ 0.364089] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[ 0.759867] console [ttyS0] enabled
[ 0.767864] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.776824] SCSI Media Changer driver v0.25
[ 0.783879] m25p80 spi0.0: w25q128 (16384 Kbytes)
[ 0.788641] 4 ofpart partitions found on MTD device spi0.0
[ 0.794218] Creating 4 MTD partitions on "spi0.0":
[ 0.799022] 0x000000000000-0x000000100000 : "u-boot"
[ 0.806106] 0x000000100000-0x000000110000 : "dtb"
[ 0.812920] 0x000000110000-0x000000510000 : "kernel"
[ 0.819922] 0x000000510000-0x000001000000 : "rootfs"
[ 0.827587] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.834222] ehci-platform: EHCI generic platform driver
[ 0.839714] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.845921] ohci-platform: OHCI generic platform driver
[ 0.851503] usbcore: registered new interface driver usb-storage
[ 0.858229] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 0.867215] i2c /dev entries driver
[ 0.872404] usbcore: registered new interface driver usbhid
[ 0.877975] usbhid: USB HID core driver
[ 0.882423] NET: Registered protocol family 17
[ 0.888456] Loading compiled-in X.509 certificates
[ 0.900734] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0636db8)
[ 0.909456] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc063609c)
[ 0.917113] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 0.923782] [drm] No driver support for vblank timestamp query.
[ 0.972455] Console: switching to colour frame buffer device 60x34
[ 0.995668] sun4i-drm display-engine: fb0: frame buffer device
[ 1.002695] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.011563] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.023278] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.029732] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.039515] hub 1-0:1.0: USB hub found
[ 1.043426] hub 1-0:1.0: 1 port detected
[ 1.048535] using random self ethernet address
[ 1.053112] using random host ethernet address
[ 1.058771] usb0: HOST MAC e2:cc:43:3b:5d:37
[ 1.063247] usb0: MAC 46:c7:2c:91:cb:ac
[ 1.067188] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.074774] g_cdc gadget: g_cdc ready
[ 1.079436] vcc3v3: disabling
[ 1.120487] random: crng init done
[ 2.227303] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[ 2.235565] devtmpfs: mounted
[ 2.243043] Freeing unused kernel memory: 1024K
# cat /proc/meminfo
MemTotal: 24776 kB
MemFree: 11992 kB
MemAvailable: 16908 kB
Buffers: 0 kB
Cached: 1284 kB
SwapCached: 0 kB
Active: 1512 kB
Inactive: 80 kB
Active(anon): 328 kB
Inactive(anon): 8 kB
Active(file): 1184 kB
Inactive(file): 72 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 24776 kB
LowFree: 11992 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 332 kB
Mapped: 1076 kB
Shmem: 28 kB
Slab: 9568 kB
SReclaimable: 6232 kB
SUnreclaim: 3336 kB
KernelStack: 192 kB
PageTables: 68 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 12388 kB
Committed_AS: 1528 kB
VmallocTotal: 999424 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
离线
不知道为啥 MemTotal: 24776 kB 这个一直都是24M左右
离线
24M 不是这个值?
Memory: 23752K/32768K available (5120K kernel code, 211K rwdata, 1140K rodata, 1024K init, 219K bss, 9016K reserved, 0K cma-reserved, 0K highmem
离线
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches这三个命令都试一下, 看有没有变化.
没啥变化,不知道怎样去降低RAM占用
离线
24M 不是这个值?
Memory: 23752K/32768K available (5120K kernel code, 211K rwdata, 1140K rodata, 1024K init, 219K bss, 9016K reserved, 0K cma-reserved, 0K highmem
用这个计算来看确实是占用了16M左右的空间,有啥方法提升可用RAM空间么?
离线
去掉一些不必要的驱动和文件系统,把kernel变小,可以省出一些Text段占用的RAM
离线
离线