| # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Tune sysctls for ARC++" |
| author "chromium-os-dev@chromium.org" |
| |
| # vm.min_filelist_kbytes controls how much of the file cache in RAM is |
| # protected (i.e. not allowed to be evicted). If too few code pages are kept, |
| # the system can thrash. Android apps add pressure to the cache, so we protect |
| # more pages when ARC++ is running. |
| # |
| # See crbug.com/709660 for discussion. |
| # Also see crbug.com/792152. |
| |
| start on started arc-boot-continue |
| stop on stopped arc-boot-continue |
| |
| # The start and stop scripts are the same (except the echo statement). |
| # The value returned by swap.sh changes depending on the container status. |
| |
| pre-start script |
| { |
| echo "Pre-start arc-sysctl" |
| KB="$(/usr/share/cros/init/swap.sh get_target_value min_filelist)" |
| exec sysctl vm.min_filelist_kbytes="${KB}" |
| } 2>&1 | logger -t "${UPSTART_JOB}" |
| end script |
| |
| post-stop script |
| { |
| echo "Post-stop arc-sysctl" |
| KB="$(/usr/share/cros/init/swap.sh get_target_value min_filelist)" |
| exec sysctl vm.min_filelist_kbytes="${KB}" |
| } 2>&1 | logger -t "${UPSTART_JOB}" |
| end script |