[kvm] improve the handling of compact_memory during kvm image build (#9184)
Build failed on a Ubuntu 20.04 system with kvm kernel, which does not have the /proc/sys/vm/compact_memory Should check if compact_memory is writeable before doing it. Signed-off-by: Chris Ward <tjcw@uk.ibm.com>
This commit is contained in:
parent
475bfc9625
commit
f8688bef8d
@ -59,7 +59,11 @@ free -m
|
||||
if [[ "$vs_build_prepare_mem" == "yes" ]]; then
|
||||
# Force o.s. to drop cache and compact memory so that KVM can get 2G memory
|
||||
bash -c 'echo 1 > /proc/sys/vm/drop_caches'
|
||||
bash -c 'echo 1 > /proc/sys/vm/compact_memory'
|
||||
# Not all kernels support compact_memory
|
||||
if [[ -w '/proc/sys/vm/compact_memory' ]]
|
||||
then
|
||||
bash -c 'echo 1 > /proc/sys/vm/compact_memory'
|
||||
fi
|
||||
free -m
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user