Missing memory. 600 MB in 2GB model

I recently bought another M4 with 2GB RAM. However free in Ubuntu 18 shows only about 600 MB RAM in the system? I can understand that some part is being shared to the GPU but I doubt it needs over 1 GB for it.

Any idea what’s the issue might be?

check this topic

It’s definitely a 2GB model. It’s says so while booting at least. Also cat /proc/meminfo displays among others:

VmallocTotal: 263061440 kB

So I assume it’s physically there but somehow can’t be used. Is there a way to assign all memory to the system instead of GPU? I don’t need X-Server

If your board is 2GB, memTotal is about 1609MB from /proc/meminfo after bootup, about 328MB reserve to a special rpc bluecore processor of rtd1395, ubuntu 18 is a desktop linux image in bpi wiki, you can try ubuntu 16 server without X-server

[email protected]:~# cat /proc/meminfo 
MemTotal:        1609848 kB
MemFree:          675460 kB
MemAvailable:     885404 kB

If someone don’t need media task, please try this patch to save more memory for system use, but you need more stability test.

diff --git a/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-1GB.dts b/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-1GB.dts
index 7525be8..710b1ea 100755
--- a/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-1GB.dts
+++ b/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-1GB.dts
@@ -7,7 +7,7 @@
 /memreserve/ ROOTFS_NORMAL_START ROOTFS_NORMAL_SIZE;
 /memreserve/ ACPU_IDMEM_PHYS ACPU_IDMEM_SIZE;
 
-#define MEDIA_REQ_SIZE_0 (0x0ce00000) // 206M
+#define MEDIA_REQ_SIZE_0 (0x01000000) // 16M
 #define ION_MEDIA_HEAP_PHYS_0 (MEM_SLOT(0, PHYS, MEDIA_REQ_SIZE_0))
 #define ION_MEDIA_HEAP_SIZE_0 (MEM_SLOT(0, SIZE, MEDIA_REQ_SIZE_0))
 #define ION_MEDIA_HEAP_FLAG_0 (MEM_SLOT(0, FLAG, MEDIA_REQ_SIZE_0))
@@ -17,14 +17,8 @@
 #define ION_AUDIO_HEAP_SIZE_0 (MEM_SLOT(1, SIZE, AUDIO_REQ_SIZE_0))
 #define ION_AUDIO_HEAP_FLAG_0 (MEM_SLOT(1, FLAG, AUDIO_REQ_SIZE_0))
 
-#define MEDIA_REQ_SIZE_1 (0x03c00000) // 60M
-#define ION_MEDIA_HEAP_PHYS_1 (MEM_SLOT(2, PHYS, MEDIA_REQ_SIZE_1))
-#define ION_MEDIA_HEAP_SIZE_1 (MEM_SLOT(2, SIZE, MEDIA_REQ_SIZE_1))
-#define ION_MEDIA_HEAP_FLAG_1 (MEM_SLOT(2, FLAG, MEDIA_REQ_SIZE_1))
-
 /memreserve/ ION_MEDIA_HEAP_PHYS_0  ION_MEDIA_HEAP_SIZE_0;
 /memreserve/ ION_AUDIO_HEAP_PHYS_0  ION_AUDIO_HEAP_SIZE_0;
-/memreserve/ ION_MEDIA_HEAP_PHYS_1  ION_MEDIA_HEAP_SIZE_1;
 
 #include "rtd-139x.dtsi"
 
@@ -58,7 +52,7 @@
 		bootargs = "earlycon=uart8250,mmio32,0x98007800 console=ttyS0,115200 init=/init loglevel=4";
 		swiotlb-memory-reservation-size = <512>; /*  512: 1MB,  2048: 4MB*/
 		swiotlb-force = <0>; /* 0: SWIOTLB_NORMAL, 1: SWIOTLB_FORCE, 2: SWIOTLB_NO_FORCE */
-		cma-region-enable = <1>;
+		cma-region-enable = <0>;
 		cma-region-info = <0x00000000 0x02000000 0x20000000>;
 		/*cma-region-info = <0x00000000 0x01000000 0x12c00000>, <0x00000000 0x12c00000 0x20000000>;*/
 	};
@@ -153,10 +147,7 @@
 			rtk,memory-reserve = <
 				ION_MEDIA_HEAP_PHYS_0
 				ION_MEDIA_HEAP_SIZE_0
-				ION_MEDIA_HEAP_FLAG_0
-				ION_MEDIA_HEAP_PHYS_1
-				ION_MEDIA_HEAP_SIZE_1
-				ION_MEDIA_HEAP_FLAG_1>;
+				ION_MEDIA_HEAP_FLAG_0>;
 		};
 	};
 
diff --git a/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-2GB.dts b/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-2GB.dts
index a2bba7c..1329aad 100755
--- a/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-2GB.dts
+++ b/linux-rtk/arch/arm64/boot/dts/realtek/rtd139x/rtd-1395-bananapi-m4-2GB.dts
@@ -7,7 +7,7 @@
 /memreserve/ ROOTFS_NORMAL_START ROOTFS_NORMAL_SIZE;
 /memreserve/ ACPU_IDMEM_PHYS ACPU_IDMEM_SIZE;
 
-#define MEDIA_REQ_SIZE_0 (0x0ce00000) // 206M
+#define MEDIA_REQ_SIZE_0 (0x01000000) // 16M
 #define ION_MEDIA_HEAP_PHYS_0 (MEM_SLOT(0, PHYS, MEDIA_REQ_SIZE_0))
 #define ION_MEDIA_HEAP_SIZE_0 (MEM_SLOT(0, SIZE, MEDIA_REQ_SIZE_0))
 #define ION_MEDIA_HEAP_FLAG_0 (MEM_SLOT(0, FLAG, MEDIA_REQ_SIZE_0))
@@ -17,14 +17,8 @@
 #define ION_AUDIO_HEAP_SIZE_0 (MEM_SLOT(1, SIZE, AUDIO_REQ_SIZE_0))
 #define ION_AUDIO_HEAP_FLAG_0 (MEM_SLOT(1, FLAG, AUDIO_REQ_SIZE_0))
 
-#define MEDIA_REQ_SIZE_1 (0x0C400000) // 196M
-#define ION_MEDIA_HEAP_PHYS_1 (MEM_SLOT(2, PHYS, MEDIA_REQ_SIZE_1))
-#define ION_MEDIA_HEAP_SIZE_1 (MEM_SLOT(2, SIZE, MEDIA_REQ_SIZE_1))
-#define ION_MEDIA_HEAP_FLAG_1 (MEM_SLOT(2, FLAG, MEDIA_REQ_SIZE_1))
-
 /memreserve/ ION_MEDIA_HEAP_PHYS_0  ION_MEDIA_HEAP_SIZE_0;
 /memreserve/ ION_AUDIO_HEAP_PHYS_0  ION_AUDIO_HEAP_SIZE_0;
-/memreserve/ ION_MEDIA_HEAP_PHYS_1  ION_MEDIA_HEAP_SIZE_1;
 
 #include "rtd-139x.dtsi"
 
@@ -58,7 +52,7 @@
 		bootargs = "earlycon=uart8250,mmio32,0x98007800 console=ttyS0,115200 init=/init loglevel=4";
 		swiotlb-memory-reservation-size = <512>; /*  512: 1MB,  2048: 4MB*/
 		swiotlb-force = <0>; /* 0: SWIOTLB_NORMAL, 1: SWIOTLB_FORCE, 2: SWIOTLB_NO_FORCE */
-		cma-region-enable = <1>;
+		cma-region-enable = <0>;
 		cma-region-info = <0x00000000 0x02000000 0x20000000>;
 		/*cma-region-info = <0x00000000 0x01000000 0x12c00000>, <0x00000000 0x12c00000 0x20000000>;*/
 	};
@@ -159,10 +153,7 @@
 			rtk,memory-reserve = <
 				ION_MEDIA_HEAP_PHYS_0
 				ION_MEDIA_HEAP_SIZE_0
-				ION_MEDIA_HEAP_FLAG_0
-				ION_MEDIA_HEAP_PHYS_1
-				ION_MEDIA_HEAP_SIZE_1
-				ION_MEDIA_HEAP_FLAG_1>;
+				ION_MEDIA_HEAP_FLAG_0>;
 		};
 	};

Ubuntu 18 mate desktop

[email protected]:~# cat /proc/meminfo 
MemTotal:        1975352 kB
MemFree:         1139764 kB
MemAvailable:    1216340 kB

Ubuntu 16 server

[email protected]:~# cat /proc/meminfo 
MemTotal:        1975352 kB
MemFree:         1792460 kB
MemAvailable:    1631816 kB

Thanks @August, I have compiled the dtb for Bpi-M4 (1GB RAM), heres the file in case anyone needs

https://1drv.ms/u/s!Ar29zDplGzdwgdMe21Vty9ncPR8OBA?e=Gh5YIz

image

@shankar thank you for sharing dtb. I’d like to try it but I don’t know how. Could you please poin me to some direction? Thanks

Replace the rtd-1395-bananapi-m4-1GB.dtb file already present in this path

BPI-BOOT/bananapi/bpi-m4/linux/rtd-1395-bananapi-m4-1GB.dtb

I’ve mounted /dev/mmcblk0p1 and there is bananapi/bpi-m4/linux/rtd-1395-bananapi-m4.dtb file but it doesn’t have “-1GB” in it’s name. I have M4 1Gb version. Should I just rename and replace it there?

The name of the dtb file used, would be mentioned in your uenv.txt file. If you are not sure, try rename and check if it works.

Renaming your file to rtd-1395-bananapi-m4.dtb worked. Thank you so much.