比如修改为4GB整:
diff --git a/kernel/mm/page_alloc.c b/kernel/mm/page_alloc.c
index d17ff05..71dd62c 100644
--- a/kernel/mm/page_alloc.c
+++ b/kernel/mm/page_alloc.c
@@ -3613,7 +3613,7 @@ static inline void show_node(struct zone *zone)
void si_meminfo(struct sysinfo *val)
{
- val->totalram = totalram_pages;
+ val->totalram = 1048576;//totalram_pages;
val->sharedram = global_page_state(NR_SHMEM);
val->freeram = global_page_state(NR_FREE_PAGES);
val->bufferram = nr_blockdev_pages();
以上修改后内存总容量显示4GB(或4096MB)。
val->freeram为剩余可用内存。
单位是一页(page),大小4k=4096 byte