blob: c9275956333b348b941bab3f4ab2dfb0b965bcb2 [file] [edit]
# Copyright 2023 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Teardown swap on shutdown"
author "ctshao@google.com"
start on stopping system-services
task
# It is exceedingly unlikely to OOM, as it's a simple dbus-send call,
# but better to kill it than to panic the system.
oom score -100
expect fork
# There is a race condition with chromeos_shutdown (b/267224195) that causes
# swap_management to be killed by process_killer before it can properly process
# a D-Bus message here. To avoid this and ensure that zram swap stops, we run
# swap_management directly instead of using dbus-send.
# Once the issue above is resolved, we should consider using D-Bus messages.
exec minijail0 --config /usr/share/minijail/swap_management.conf \
-- /usr/sbin/swap_management --swap_stop