Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935412AbcKWKfE (ORCPT ); Wed, 23 Nov 2016 05:35:04 -0500 Received: from mout.gmx.net ([212.227.17.22]:55700 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933453AbcKWKd4 (ORCPT ); Wed, 23 Nov 2016 05:33:56 -0500 Message-ID: <1479897217.4306.6.camel@gmx.de> Subject: [patch] sched/autogroup: Fix 64bit kernel nice adjustment From: Mike Galbraith To: "Michael Kerrisk (man-pages)" Cc: Peter Zijlstra , Ingo Molnar , linux-man , lkml , Thomas Gleixner Date: Wed, 23 Nov 2016 11:33:37 +0100 In-Reply-To: <41d802dc-873a-ff02-17ff-93ce50f3e925@gmail.com> References: <41d802dc-873a-ff02-17ff-93ce50f3e925@gmail.com> Content-Type: text/plain; charset="iso-2022-jp" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:hMAG5wHF9/OaHQih8Y32OHUqi204/WeMTidi7lyjUFwrT/OZN5x 1x4wJEoPcz6eTtNrp33hJnozLA9mwu8c/QUuTZeQzQu8DAGj96bDZ2J8cHZmVF0jNfVVYr8 nvgBeiZlmLjFl1ooqTn0xh/xjzxUsT5zYEbYY186LGN0nfU2aRuQrCOwTPZVdK2ezMX9RjQ 72L/xqupNMec2Y/QWIPWw== X-UI-Out-Filterresults: notjunk:1;V01:K0:AKZVsXij8/4=:LrH6wRt7hIeyZacGMt8vQ6 8OH0o3YsI5P/SzOVfQHU9t3VZO9L38mBBlbBvjt4kt9XANxcHHMxaJEHyPXUHen+N0A+hAs06 M/zguD0Q6akjJJFJzzxe48hG/Ydtgl+tA0/oZyANPWfj8OqYPs+1rhgkABisu9K/u7zG6/Suy pO0oIcUzduNVCL07yURsd2HUgfqxaA2b62g7GjUbzOr5uuI5mNhdU1TuVEOW5Jvw5k72Qo9Pz GKlrvOrydvx3+/avw2IkXKCUjjpfIj5DNOUUVhriQFDfd0YME3oH/3PRjM4FJRtbBh7BhdPcu uRzNrwA3aa539KcYfawi0kIqupiNamA4bWhecjy3sZES0fPb1Hp4ZuvsQN7Ag+4RoQL4tXShN 1BTWGy4BZlhe8YN/OVYkPLVVCDlW50mov57YeSZXVOlWxCK29vdoSL9Sxo+dHdCZKMWx7uJ1F vGH792IjPT06TeP0K9FLTExmu22I06zjv7HWdD77on3nzB2FJzr0cKnqnde9a6MOjpA+waDi6 YQmppXN5RonbC16k9IYGnz05kQ4ApqB+RWD1BU+pADP0Y16PBEmFILJVGKl4WfnfiZsva0SJf +7R+xylkauYaXZSnpjQrLb6M4MFM1dH5OWdI7MVXlkkK3VWwPOhJUwdu30vqkmtdPeJzjrf4R FKPZOfWm4/86tJXepA3rJSFfUGbSI0YzAq6jdbdVhYmMhbMo9cKN/X5JW0ONkyrr68C+DCHd9 jjv/UeB1J3ShEE7LWPM4r2T8GLQGbzCNRo9ubftMkSPFrjnxN1ZI4u6oWPteO2MXrmsJuwP/l FOL9wOA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1755 Lines: 45 On Tue, 2016-11-22 at 16:59 +0100, Michael Kerrisk (man-pages) wrote: > ┌─────────────────────────────────────────────────────┐ > │FIXME │ > ├─────────────────────────────────────────────────────┤ > │Regarding the previous paragraph... My tests indi‐ │ > │cate that writing *any* value to the autogroup file │ > │causes the task group to get a lower priority. This │ Because autogroup didn't call the then meaningless scale_load()... Autogroup nice level adjustment has been broken ever since load resolution was increased for 64bit kernels. Use scale_load() to scale group weight. Signed-off-by: Mike Galbraith Reported-by: Michael Kerrisk Cc: stable@vger.kernel.org --- kernel/sched/auto_group.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/kernel/sched/auto_group.c +++ b/kernel/sched/auto_group.c @@ -192,6 +192,7 @@ int proc_sched_autogroup_set_nice(struct { static unsigned long next = INITIAL_JIFFIES; struct autogroup *ag; + unsigned long shares; int err; if (nice < MIN_NICE || nice > MAX_NICE) @@ -210,9 +211,10 @@ int proc_sched_autogroup_set_nice(struct next = HZ / 10 + jiffies; ag = autogroup_task_get(p); + shares = scale_load(sched_prio_to_weight[nice + 20]); down_write(&ag->lock); - err = sched_group_set_shares(ag->tg, sched_prio_to_weight[nice + 20]); + err = sched_group_set_shares(ag->tg, shares); if (!err) ag->nice = nice; up_write(&ag->lock);