[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b3689d7f-1a78-46ea-8e1f-48bc080ce993@app.fastmail.com>
Date: Fri, 19 May 2023 22:20:21 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: guoren <guoren@...nel.org>, "Palmer Dabbelt" <palmer@...osinc.com>,
"Thomas Gleixner" <tglx@...utronix.de>,
"Peter Zijlstra" <peterz@...radead.org>,
"Andy Lutomirski" <luto@...nel.org>,
"Conor.Dooley" <conor.dooley@...rochip.com>,
Heiko Stübner <heiko@...ech.de>,
"Jisheng Zhang" <jszhang@...nel.org>,
"Huacai Chen" <chenhuacai@...nel.org>,
"Anup Patel" <apatel@...tanamicro.com>,
"Atish Patra" <atishp@...shpatra.org>,
"Mark Rutland" <mark.rutland@....com>,
Björn Töpel <bjorn@...nel.org>,
"Paul Walmsley" <paul.walmsley@...ive.com>,
"Catalin Marinas" <catalin.marinas@....com>,
"Will Deacon" <will@...nel.org>, "Mike Rapoport" <rppt@...nel.org>,
"Anup Patel" <anup@...infault.org>, shihua@...as.ac.cn,
jiawei@...as.ac.cn, liweiwei@...as.ac.cn, luxufan@...as.ac.cn,
chunyu@...as.ac.cn, tsu.yubo@...il.com, wefu@...hat.com,
wangjunqiang@...as.ac.cn, kito.cheng@...ive.com,
"Andy Chiu" <andy.chiu@...ive.com>,
"Vincent Chen" <vincent.chen@...ive.com>,
"Greentime Hu" <greentime.hu@...ive.com>,
"Jonathan Corbet" <corbet@....net>, wuwei2016@...as.ac.cn,
"Jessica Clarke" <jrtc27@...c27.com>
Cc: Linux-Arch <linux-arch@...r.kernel.org>,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
"Guo Ren" <guoren@...ux.alibaba.com>
Subject: Re: [RFC PATCH 00/22] riscv: s64ilp32: Running 32-bit Linux kernel on 64-bit
supervisor mode
On Thu, May 18, 2023, at 15:09, guoren@...nel.org wrote:
> From: Guo Ren <guoren@...ux.alibaba.com>
> Why 32-bit Linux?
> =================
> The motivation for using a 32-bit Linux kernel is to reduce memory
> footprint and meet the small capacity of DDR & cache requirement
> (e.g., 64/128MB SIP SoC).
>
> Here are the 32-bit v.s. 64-bit Linux kernel data type comparison
> summary:
> 32-bit 64-bit
> sizeof(page): 32bytes 64bytes
> sizeof(list_head): 8bytes 16bytes
> sizeof(hlist_head): 8bytes 16bytes
> sizeof(vm_area): 68bytes 136bytes
> ...
> Mem-usage:
> (s32ilp32) # free
> total used free shared buff/cache available
> Mem: 100040 8380 88244 44 3416 88080
>
> (s64lp64) # free
> total used free shared buff/cache available
> Mem: 91568 11848 75796 44 3924 75952
>
> (s64ilp32) # free
> total used free shared buff/cache available
> Mem: 101952 8528 90004 44 3420 89816
> ^^^^^
>
> It's a rough measurement based on the current default config without any
> modification, and 32-bit (s32ilp32, s64ilp32) saved more than 16% memory
> to 64-bit (s64lp64). But s32ilp32 & s64ilp32 have a similar memory
> footprint (about 0.33% difference), meaning s64ilp32 has a big chance to
> replace s32ilp32 on the 64-bit machine.
I've tried to run the same numbers for the debate about running
32-bit vs 64-bit arm kernels in the past, but focused mostly on
slightly larger systems, but I looked mainly at the 512MB case,
as that is the most cost-efficient DDR3 memory configuration
and fairly common.
What I'd like to understand better in your example is where
the 14MB of memory went. I assume this is for 128MB of total
RAM, so we know that 1MB went into additional 'struct page'
objects (32 bytes * 32768 pages). It would be good to know
where the dynamic allocations went and if they are reclaimable
(e.g. inodes) or non-reclaimable (e.g. kmalloc-128).
For the vmlinux size, is this already a minimal config
that one would run on a board with 128MB of RAM, or a
defconfig that includes a lot of stuff that is only relevant
for other platforms but also grows on 64-bit?
What do you see in /proc/slabinfo, /proc/meminfo/, and
'size vmlinux' for the s64ilp32 and s64lp64 kernels here?
Arnd
Powered by blists - more mailing lists