Platform process pinning

Add a service to pin processes back to platform cores after
affine-platform. Previously this was done during the nova-compute
wrapper script. In kubernetes this script is not run so we need to add
a new service to pin tasks back to the platform cores.

Depends-On: https://review.openstack.org/#/c/634035/
Story: 2002843
Task: 29125
Change-Id: Ia8ccacb5546a8ea66010b024fe04ed39f9ef447d
Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
David Sullivan 2019-01-27 23:16:57 -05:00
parent 3cc2f5e1fb
commit 76d3082421
5 changed files with 88 additions and 1 deletions

View File

@ -1,3 +1,3 @@
SRC_DIR="worker-utils"
COPY_LIST="$SRC_DIR/LICENSE"
TIS_PATCH_VER=1
TIS_PATCH_VER=2

View File

@ -39,6 +39,7 @@ make install BINDIR=%{buildroot}%{local_bindir} \
%post
/bin/systemctl enable affine-platform.sh.service >/dev/null 2>&1
/bin/systemctl enable affine-tasks.service >/dev/null 2>&1
%clean
rm -rf $RPM_BUILD_ROOT
@ -53,3 +54,4 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{local_etc_platform}/worker_reserved.conf
%{_unitdir}/affine-platform.sh.service
%{_unitdir}/affine-tasks.service

View File

@ -18,6 +18,7 @@ install:
install -d -m 755 $(PLATFORMCONFDIR)
install -d -m 755 $(SYSTEMDDIR)
install -p -D -m 755 affine-platform.sh $(INITDDIR)/affine-platform.sh
install -p -D -m 755 affine-tasks.sh $(INITDDIR)/affine-tasks.sh
install -p -D -m 755 cpumap_functions.sh $(INITDDIR)/cpumap_functions.sh
install -p -D -m 755 task_affinity_functions.sh $(INITDDIR)/task_affinity_functions.sh
install -p -D -m 755 ps-sched.sh $(BINDIR)/ps-sched.sh
@ -29,3 +30,4 @@ install:
install -p -D -m 755 worker_reserved.conf $(PLATFORMCONFDIR)/worker_reserved.conf
install -p -D -m 755 worker-goenabled.sh $(GOENABLEDDIR)/worker-goenabled.sh
install -p -D -m 664 affine-platform.sh.service $(SYSTEMDDIR)/affine-platform.sh.service
install -p -D -m 664 affine-tasks.service $(SYSTEMDDIR)/affine-tasks.service

View File

@ -0,0 +1,12 @@
[Unit]
Description=StarlingX Affine Tasks
After=syslog.service network.service dbus.service sw-patch.service affine-platform.sh.service
Before=kubelet.service
Requires=kubelet.service
[Service]
Type=oneshot
ExecStart=/etc/init.d/affine-tasks.sh start
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,71 @@
#!/bin/bash
###############################################################################
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
###############################################################################
# This script will affine tasks to the platform cores of the host.
# This ensures that system processes are constrained to platform cores and will
# not run on cores with VMs/containers.
. /usr/bin/tsconfig
. /etc/init.d/task_affinity_functions.sh
log ()
{
logger -p local1.info -t affine_tasks $@
echo affine_tasks: "$@"
}
start ()
{
log "Starting affine_tasks. Reaffining tasks to platform cores..."
if [ ! -f ${INITIAL_CONFIG_COMPLETE_FLAG} ]; then
log "Initial Configuration incomplete. Skipping affining tasks."
exit 0
fi
affine_tasks_to_platform_cores
[[ $? -eq 0 ]] && log "Tasks re-affining done." || log "Tasks re-affining failed."
}
stop ()
{
log "Stopping affine_tasks..."
}
status()
{
:
}
reset()
{
:
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
reset)
reset
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
exit 1
;;
esac
exit 0