kmod: run usermodehelpers only on cpus allowed for kthreadd V2
hulk inclusion category: feature feature: performance/latency upstream: never bugzilla: 2680,10641 CVE: NA isolate this usermodehelper kernel threads to other cpus, to avoid the latency issue. With this patch, the usermodehelper thread could inherit kthreadd's affinity. For example, if you want to isolate usermodehelper to cpu 1: 1) taskset -cp 1 2 # bind kthreadd task (pid = 2) to cpu 1 2) trigger call usermodhelper threads --------------------------------------------- usermodehelper() threads can currently run on all processors. This is an issue for low latency cores. Spawnig a new thread causes cpu holdoffs in the range of hundreds of microseconds to a few milliseconds. Not good for cores on which processes run that need to react as fast as possible. kthreadd threads can be restricted using taskset to a limited set of processors. Then the kernel thread pool will not fork processes on those anymore thereby protecting those processors from additional latencies. Make usermodehelper() threads obey the limitations that kthreadd is restricted to. Kthreadd is not the parent of usermodehelper threads so we need to explicitly get the allowed processors for kthreadd. Before this patch there is no way to limit the cpus that usermodehelper can run on since the affinity is set when the thread is spawned to all processors. [akpm@linux-foundation.org: set_cpus_allowed() doesn't exist when CONFIG_CPUMASK_OFFSTACK=y] [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: NChristoph Lameter <cl@linux.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <bitbucket@online.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Gilad Ben-Yossef <gilad@benyossef.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Tejun Heo <tj@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: NAndrew Morton <akpm@linux-foundation.org> Link: https://patchwork.kernel.org/patch/3153671/Reported-and-tested-by: NXiangyou Xie <xiexiangyou@huawei.com> [ 1) kmod.c => umh.c 2) ____call_usermodehelper => call_usermodehelper_exec_async ] Signed-off-by: NXie XiuQi <xiexiuqi@huawei.com> Reviewed-by: NLi Bin <huawei.libin@huawei.com> Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Showing
想要评论请 注册 或 登录