public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Yinghai Lu <yinghai@kernel.org>,
	mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, jes@sgi.com,
	jens.axboe@oracle.com, tglx@linutronix.de, mingo@elte.hu,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Arjan van de Ven <arjan@infradead.org>,
	linux-tip-commits@vger.kernel.org
Subject: Re: [PATCH] sched: Avoid division by zero - really
Date: Thu, 27 Aug 2009 14:19:56 +0200	[thread overview]
Message-ID: <4A9679EC.1030108@gmail.com> (raw)
In-Reply-To: <1251371336.18584.77.camel@twins>

Peter Zijlstra a écrit :
> When re-computing the shares for each task group's cpu representation we
> need the ratio of weight on each cpu vs the total weight of the sched
> domain.
> 
> Since load-balancing is loosely (read not) synchronized, the weight of
> individual cpus can change between doing the sum and calculating the
> ratio.
> 
> The previous patch dealt with only one of the race scenarios, this patch
> side steps them all by saving a snapshot of all the individual cpu
> weights, thereby always working on a consistent set.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  kernel/sched.c |   50 +++++++++++++++++++++++++++++---------------------
>  1 files changed, 29 insertions(+), 21 deletions(-)
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 0e76b17..4591054 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -1515,30 +1515,29 @@ static unsigned long cpu_avg_load_per_task(int cpu)
>  
>  #ifdef CONFIG_FAIR_GROUP_SCHED
>  
> +struct update_shares_data {
> +	unsigned long rq_weight[NR_CPUS];
> +};
> +
> +static DEFINE_PER_CPU(struct update_shares_data, update_shares_data);

ouch... thats quite large IMHO, up to 4096*8 = 32768 bytes per cpu...

Now we have nice dynamic per cpu allocations, we could use it here,
and use nr_cpus instead of NR_CPUS as the array size ?


  reply	other threads:[~2009-08-27 12:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 10:53 Latest Linus tree oopses on Nehalem box Jes Sorensen
2009-08-21 11:46 ` Ingo Molnar
2009-08-21 11:58   ` Peter Zijlstra
2009-08-21 14:42     ` [tip:sched/core] sched: Avoid division by zero tip-bot for Peter Zijlstra
2009-08-25 19:11       ` Peter Zijlstra
2009-08-26  9:16         ` Yinghai Lu
2009-08-26  9:25           ` Peter Zijlstra
2009-08-27 11:08           ` [PATCH] sched: Avoid division by zero - really Peter Zijlstra
2009-08-27 12:19             ` Eric Dumazet [this message]
2009-08-27 12:32               ` Peter Zijlstra
2009-08-28  6:30             ` [tip:sched/core] sched: Fix " tip-bot for Peter Zijlstra
2009-08-21 13:04   ` Latest Linus tree oopses on Nehalem box Jes Sorensen
2009-08-21 13:26     ` Ingo Molnar
2009-08-21 13:35       ` Jes Sorensen

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=4A9679EC.1030108@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=arjan@infradead.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jens.axboe@oracle.com \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yinghai@kernel.org \
    /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