kexec: improve the readability of crash_shrink_memory()
authorZhen Lei <thunder.leizhen@huawei.com>
Sat, 27 May 2023 12:34:37 +0000 (20:34 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 10 Jun 2023 00:44:24 +0000 (17:44 -0700)
commit8a7db7790a3ff8413bedef886cf135ba301e88d7
tree4b3971474b15fe3ce67d2c9a04ec9b6c853186af
parentf7f567b95b12eda7a6a273b8cb82d152491bc0da
kexec: improve the readability of crash_shrink_memory()

The major adjustments are:
1. end = start + new_size.
   The 'end' here is not an accurate representation, because it is not the
   new end of crashk_res, but the start of ram_res, difference 1. So
   eliminate it and replace it with ram_res->start.
2. Use 'ram_res->start' and 'ram_res->end' as arguments to
   crash_free_reserved_phys_range() to indicate that the memory covered by
   'ram_res' is released from the crashk. And keep it close to
   insert_resource().
3. Replace 'if (start == end)' with 'if (!new_size)', clear indication that
   all crashk memory will be shrunken.

No functional change.

Link: https://lkml.kernel.org/r/20230527123439.772-5-thunder.leizhen@huawei.com
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/kexec_core.c