public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <libo.chen@huawei.com>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: <tglx@linutronix.de>, <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	"Li Zefan" <lizefan@huawei.com>, <peterz@infradead.org>
Subject: Re: balance storm
Date: Mon, 26 May 2014 20:16:55 +0800	[thread overview]
Message-ID: <538330B7.5070503@huawei.com> (raw)
In-Reply-To: <1401081082.5339.41.camel@marge.simpson.net>

On 2014/5/26 13:11, Mike Galbraith wrote:
> On Mon, 2014-05-26 at 11:04 +0800, Libo Chen wrote: 
>> hi,
>>     my box has 16 cpu (E5-2658,8 core, 2 thread per core), i did a test on
>> 3.4.24stable, startup 50 same process, every process is sample:
>>
>>  	#include <unistd.h>
>>
>>  	int main()
>>  	{
>>           	for (;;)
>>           	{
>>                   	unsigned int i = 0;
>>                  	 while (i< 100){
>>                      	 i++;
>>                   	}
>>                   	usleep(100);
>>           	}
>>
>>          	 return 0;
>>   	}
>>
>> the result is process uses 15% cpu time, perf tool shows 70w migrations in 5 second.
> 
> See e0a79f52 sched: Fix select_idle_sibling() bouncing cow syndrome
> 
> That commit will fix expensive as hell bouncing for most real loads, but
> it won't fix your test.  Doing nothing but wake, select_idle_sibling()
> will be traversing all cores/siblings mightily, taking L2 misses as it
> traverses, bouncing wakees that do _nothing_ when an idle CPU is found.
> 
> Your synthetic test is the absolute worst case scenario.  There has to
> be work between wakeups for select_idle_sibling() to have any chance
> whatsoever of turning in a win.  At 0 work, it becomes 100% overhead.

not synthetic, it is a real problem in our product. under no load, waste
much cpu time.

> 
>> I guess task migration takes up a lot of cpu, so i did another test. use taskset tool to bind
>> a task to a fixed cpu. Results in line with expectations, cpu usage is down to 5%.
>>
>> other test:
>> - 3.15upstream has the same problem with 3.4.24.
>> - suse sp2 has low cpu usage about 5%.
> 
> SLE11-SP2 has a patch which fixes that behavior, but of course at the
> expense of other load types.  A trade.  It also throttles nohz, which
> can have substantial cost when cross CPU scheduling.

which patch ?

> 
>> so I think 15% cpu usage and migration event are too high, how to fixed?
> 
> You can't for free, low latency wakeup can be worth one hell of a lot.
> 
> You could do a decayed hit/miss or such to shut the thing off when the
> price is just too high.  Restricting migrations per unit time per task
> also helps cut the cost, but hurts tasks that could have gotten to the
> CPU quicker, and started your next bit of work.  Anything you do there
> is going to be a rob Peter to pay Paul thing.
> 

I had tried to change sched_migration_cost and sched_nr_migrate in /proc,
but no use.  any other  suggestion?

I still think this is a problem to schedular.  it is better to directly solve
this issue instead of a workaroud


thanks,
Libo

> -Mike
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 



  reply	other threads:[~2014-05-26 12:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26  3:04 balance storm Libo Chen
2014-05-26  5:11 ` Mike Galbraith
2014-05-26 12:16   ` Libo Chen [this message]
2014-05-26 14:19     ` Mike Galbraith
2014-05-27  7:56       ` Libo Chen
2014-05-27  9:55         ` Mike Galbraith
2014-05-27 12:50           ` Libo Chen
2014-05-27 13:20             ` Mike Galbraith
2014-05-28  1:04               ` Libo Chen
2014-05-28  1:53                 ` Mike Galbraith
2014-05-28  6:54                   ` Libo Chen
2014-05-28  8:16                     ` Mike Galbraith
2014-05-28  9:08                     ` Thomas Gleixner
2014-05-28 10:30                       ` Peter Zijlstra
2014-05-28 10:52                         ` Borislav Petkov
2014-05-28 11:43                       ` Libo Chen
2014-05-28 11:55                         ` Mike Galbraith
2014-05-29  7:58                           ` Libo Chen
2014-05-29  7:57                       ` Libo Chen
2014-05-27 20:53             ` Thomas Gleixner
2014-05-28  1:06               ` Libo Chen
2014-05-26  7:56 ` Mike Galbraith
2014-05-26 11:49   ` Libo Chen
2014-05-26 14:03     ` Mike Galbraith
2014-05-27  7:44       ` Libo Chen
2014-05-27  8:12         ` Mike Galbraith
2014-05-27  9:48     ` Peter Zijlstra
2014-05-27 10:05       ` Mike Galbraith
2014-05-27 10:43         ` Peter Zijlstra
2014-05-27 10:55           ` Mike Galbraith
2014-05-27 12:56             ` Libo Chen
2014-05-27 12:55       ` Libo Chen
2014-05-27 13:13         ` Peter Zijlstra

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=538330B7.5070503@huawei.com \
    --to=libo.chen@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=umgwanakikbuti@gmail.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