Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528301

[patch] sched/autogroup: Fix 64bit kernel nice adjustment

From Mike Galbraith <efault@gmx.de>
Newsgroups linux.kernel
Subject [patch] sched/autogroup: Fix 64bit kernel nice adjustment
Date 2016-11-23 11:40 +0100
Message-ID <sGD86-3GY-35@gated-at.bofh.it> (permalink)
References <sGlXA-18B-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <umgwanakikbuti@gmail.com>
Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
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);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RFC: documentation of the autogroup feature "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-22 17:20 +0100
  [patch] sched/autogroup: Fix 64bit kernel nice adjustment Mike Galbraith <efault@gmx.de> - 2016-11-23 11:40 +0100
    Re: [patch] sched/autogroup: Fix 64bit kernel nice adjustment "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 14:50 +0100
      Re: [patch] sched/autogroup: Fix 64bit kernel nice adjustment Mike Galbraith <efault@gmx.de> - 2016-11-23 15:20 +0100
        Re: [patch] sched/autogroup: Fix 64bit kernel nice adjustment "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 15:30 +0100
          Re: [patch] sched/autogroup: Fix 64bit kernel nice adjustment Mike Galbraith <efault@gmx.de> - 2016-11-23 17:00 +0100
    [tip:sched/urgent] sched/autogroup: Fix 64-bit kernel nice level  adjustment tip-bot for Mike Galbraith <tipbot@zytor.com> - 2016-11-24 07:30 +0100
  Re: RFC: documentation of the autogroup feature Mike Galbraith <efault@gmx.de> - 2016-11-23 12:50 +0100
    Re: RFC: documentation of the autogroup feature "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 15:00 +0100
      Re: RFC: documentation of the autogroup feature Mike Galbraith <efault@gmx.de> - 2016-11-23 16:40 +0100
        Re: RFC: documentation of the autogroup feature "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 17:10 +0100
          Re: RFC: documentation of the autogroup feature Mike Galbraith <efault@gmx.de> - 2016-11-23 18:20 +0100
            Re: RFC: documentation of the autogroup feature "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 23:50 +0100
        Re: RFC: documentation of the autogroup feature "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-23 17:10 +0100
          Re: RFC: documentation of the autogroup feature Mike Galbraith <efault@gmx.de> - 2016-11-23 18:20 +0100
            RFC: documentation of the autogroup feature [v2] "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-11-24 22:50 +0100

csiph-web