FAILED: patch "[PATCH] x86/resctrl: Don't move a task to the same resource group" failed to apply to 4.14-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a0195f314a25582b38993bf30db11c300f4f4611 Mon Sep 17 00:00:00 2001
From: Fenghua Yu <[email protected]>
Date: Thu, 17 Dec 2020 14:31:19 -0800
Subject: [PATCH] x86/resctrl: Don't move a task to the same resource group
Shakeel Butt reported in [1] that a user can request a task to be moved to a resource group even if the task is already in the group. It just wastes time to do the move operation which could be costly to send IPI to a different CPU.
Add a sanity check to ensure that the move operation only happens when the task is not already in the resource group.
[1] https://lore.kernel.org/lkml/CALvZod7E9zzHwenzf7objzGKsdBmVwTgEJ0nPgs0LUFU3SN5Pw@mail.gmail.com/
arch/x86/kernel/cpu/resctrl/rdtgroup.c +7 -0
@@ -546,6 +546,13 @@ static void update_task_closid_rmid(struct task_struct *t)static int __rdtgroup_move_task (struct task_struct *tsk,struct rdtgroup *rdtgrp) { +/* If the task is already in rdtgrp, no need to move the task. */ +if ((rdtgrp->type ==RDTCTRL_GROUP && tsk->closid == rdtgrp->closid && + tsk->rmid == rdtgrp->mon.rmid) || + (rdtgrp->type ==RDTMON_GROUP && tsk->rmid == rdtgrp->mon.rmid && + tsk->closid == rdtgrp->mon.parent->closid)) +return 0 ; +/* * Set the task's closid/rmid before the PQR_ASSOC MSR can be * updated by them.