[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230527123439.772-1-thunder.leizhen@huawei.com>
Date: Sat, 27 May 2023 20:34:33 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Eric Biederman <ebiederm@...ssion.com>,
Baoquan He <bhe@...hat.com>, <kexec@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>,
Michael Holzheu <holzheu@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Amerigo Wang <amwang@...hat.com>
Subject: [PATCH 0/6] kexec: enable kexec_crash_size to support two crash kernel regions
When crashkernel=X fails to reserve region under 4G, it will fall back to
reserve region above 4G and a region of the default size will also be reserved
under 4G. Unfortunately, /sys/kernel/kexec_crash_size only supports one crash
kernel region now, the user cannot sense the low memory reserved by reading
/sys/kernel/kexec_crash_size. Also, low memory cannot be freed by writing this
file.
For example:
resource_size(crashk_res) = 512M
resource_size(crashk_low_res) = 256M
The result of 'cat /sys/kernel/kexec_crash_size' is 512M, but it should be 768M.
When we execute 'echo 0 > /sys/kernel/kexec_crash_size', the size of crashk_res
becomes 0 and resource_size(crashk_low_res) is still 256 MB, which is incorrect.
Since crashk_res manages the memory with high address and crashk_low_res manages
the memory with low address, crashk_low_res is shrunken only when all crashk_res
is shrunken. And because when there is only one crash kernel region, crashk_res
is always used. Therefore, if all crashk_res is shrunken and crashk_low_res still
exists, swap them.
Zhen Lei (6):
kexec: fix a memory leak in crash_shrink_memory()
kexec: delete a useless check in crash_shrink_memory()
kexec: clear crashk_res if all its memory has been released
kexec: improve the readability of crash_shrink_memory()
kexec: add helper __crash_shrink_memory()
kexec: enable kexec_crash_size to support two crash kernel regions
kernel/kexec_core.c | 92 +++++++++++++++++++++++++++++++--------------
1 file changed, 64 insertions(+), 28 deletions(-)
--
2.25.1
Powered by blists - more mailing lists