public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: fair-group: fix a Div0 error of the fair group scheduler
Date: Mon, 28 Apr 2008 14:51:41 +0200	[thread overview]
Message-ID: <20080428125141.GF27997@elte.hu> (raw)
In-Reply-To: <481558A0.9020803@cn.fujitsu.com>


* Miao Xie <miaox@cn.fujitsu.com> wrote:

> When I echoed 0 into the "cpu.shares" file, a Div0 error occured.
>
> We found it is caused by the following calling.
>
>   sched_group_set_shares(tg, shares)
>       set_se_shares(tg->se[i], shares/nr_cpu_ids)
>           __set_se_shares(se, shares)
>               div64_64((1ULL<<32), shares)
>
> When the echoed value was less than the number of processores, the 
> result of the sentence "shares/nr_cpu_ids" was 0, and then the system 
> called div64() to divide the result, the Div0 error occured.
>
> It is unnecessary that the shares value is divided by nr_cpu_ids, I 
> think. Because in the function __update_group_shares_cpu() and 
> init_tg_cfs_entry(), the shares value isn't divided by nr_cpu_ids when 
> setting shares of the sched entity.
>
> This patch fixes this bug. And echoing ULONG_MAX value into cpu.shares 
> also causes Div0 error, so we set a macro MAX_SHARES to limit the max 
> value of shares.

thanks, applied.

	Ingo

      parent reply	other threads:[~2008-04-28 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28  4:54 [PATCH] sched: fair-group: fix a Div0 error of the fair group scheduler Miao Xie
2008-04-28  5:45 ` Peter Zijlstra
2008-04-28  8:27   ` Miao Xie
2008-04-28  8:33     ` Peter Zijlstra
2008-04-28  8:34 ` Peter Zijlstra
2008-04-28 12:51 ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080428125141.GF27997@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox