[PATCH] sched: fix clear rq->nohz_balance_kick 

lkml: https://lkml.org/lkml/2013/5/30/334
      https://lkml.org/lkml/2013/6/5/92

I have faced a sequence where the Idle Load Balance was sometime not
triggered for a while on my platform.

CPU 0 and CPU 1 are running tasks and CPU 2 is idle

CPU 1 kicks the Idle Load Balance
CPU 1 selects CPU 2 as the new Idle Load Balancer
CPU 2 sets NOHZ_BALANCE_KICK for CPU 2
CPU 2 sends a reschedule IPI to CPU 2
While CPU 3 wakes up, CPU 0 or CPU 1 migrates a waking up task A on CPU 2
CPU 2 finally wakes up, runs task A and discards the Idle Load Balance
task A quickly goes back to sleep (before a tick occurs on CPU 2)
CPU 2 goes back to idle with NOHZ_BALANCE_KICK set

Whenever CPU 2 will be selected as the ILB, no reschedule IPI will be sent
because NOHZ_BALANCE_KICK is already set and no Idle Load Balance will be
performed.

We must wait for the sched softirq to be raised on CPU 2 thanks to another
part the kernel to come back to clear NOHZ_BALANCE_KICK.

The proposed solution clears NOHZ_BALANCE_KICK in schedule_ipi if
we can't raise the sched_softirq for the Idle Load Balance.

Change since V1:
- move the clear of NOHZ_BALANCE_KICK in got_nohz_idle_kick if the ILB
can't run on this CPU (as suggested by Peter)

-------------------
Note-by-Charles: NOHZ_BALANCE_KICK flag is not in our kernel util now,
so all these NOHZ_BALANCE_KICKs talked above are actually rq->nohz_balance_kick.
-------------------

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Charles Wang <muming.wq@taobao.com>
utrace: record the child's pid in its own pidns

The engine should record the child process' pid in its own pid-namespace,
not the global one.
Merge pull request #5 from CharlesWang/dev

[PATCH] sched: fix clear rq->nohz_balance_kick
Merge pull request #6 from jesuszhu/utracepid

utrace: record the child's pid in its own pidns
Merge pull request #11 from shazj99/dev

driver/igb: remove file igb.mod.c
flashcache: fix scheduler switch panic bug

After applied "multi request list" patches for flashcache, when calling blk_get_rl and the
scheduler is switching right now, it will get a 'dead' request-list, so we add condition
to fetch root_rl when io-scheduler is switching.

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: add new io-scheduler 'tpps' mainly from cfq code

We want to use blkio.cgroup on high-speed device (like fusionio) for our mysql clusters.
After testing different io-scheduler, we found that  cfq is too slow and deadline can't run on cgroup.
So we developed a new io-scheduler: tpps (Tiny Parallel Proportion Scheduler).It dispatch requests
only by using their individual weight and total weight (proportion) therefore it's simply and efficient.

The main code framework of tpps is from cfq.

Test case: fusionio card, 4 cgroups, iodepth-512

groupname  weight
test1      1000
test2      800
test3      600
test4      400

Use tpps, the result is:

groupname  iops    avg-rt(ms)   max-rt(ms)
test1      30220   16           54
test2      28261   18           56
test3      26333   19           69
test4      20152   25           87

Use cfq, the result is:

groupname  iops    avg-rt(ms)   max-rt(ms)
test1      16478   30           242
test2      13015   39           347
test3       9300   54           371
test4       5806   87           393

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: add new func tpps_forced_dispatch()

Add new func tpps_forced_dispatch() to dispatch all requests forcely.
Without this dmesg will report warning.

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: update weight of group timely

Update the group's weight before compute quota of a group in tpps_dispatch_request()
for dispatching precisely.

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: add new blkio_policy_type for tpps

Add new blkio_policy_type with plid equaling to "BLKIO_POLICY_TPPS" so
the blkcg_get_weight could get right 'weight' value.

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: add new members in struct io_context for new scheduler

Add new radix_tree and tic_data in struct io_context for tpps to avoid
conflict between cfq and tpps when useing context structure of io.

Signed-off-by: Robin Dong <sanbai@taobao.com>
tpps: add check before tpps_del_queue()

We found panic on BUG_ON(tppg->nr_tppq < 1) in pressure-testing.
After long term (about one month) tracing we finally find out the reason: some scsi_cmds
passed from scsi_ioctl will call blk_execute_rq_nowait and call tpps_set_request() but
never call tpps_insert_request() (It even doesn't get into io-scheduler) so the counter
of nr_tppq gets wrong.
To fix it, we add check before calling tpps_del_queue() and for making it safer, adding
check before BUG_ON() to report more information.

Signed-off-by: Robin Dong <sanbai@taobao.com>
fix task starttime in container

Patch-mainline: inhouse
References:

task's starttime = time_since_1970 - time_since_boot +
                   (task_start_time - wall_to_monotonic) / HZ

Time_since_boot is the time reading from /proc/uptime, which
fixed in patch fix-uptime-in-container.patch to real uptime in
container. In order to get right task starttime in container,
task_start_time should be fix to 'task_start_time - init_task->start_time'.

Signed-off-by: Charles Wang <muming.wq@taobao.com>
Merge pull request #15 from CharlesWang/dev

fix task starttime in container
Merge pull request #13 from RobinDong/dev

Add new io-scheduler tpps
disk-bind: pass slot and phynum from mpt2sas driver to sd_probe()

The mpt2sas driver could get slot and phynum from SAS-card, so we
could pass it to sd_probe() by sdev_gendev.

Signed-off-by: Robin Dong <sanbai@taobao.com>
disk-bind: call ext4_free_io_end() even with io error

If the ext4_convert_unwritten_extents() returns an error,
we no longer keep the end_io structure on the linked list.
This doesn't help, because it tends to lock up the file system and wedges
the system.  That's one way to call attention to the problem, but it
doesn't help the overall robustness of the system.

Part of the patch comes from http://kernel.opensuse.org/cgit/kernel/commit/?id=b82e384c7b

Signed-off-by: Robin Dong <sanbai@taobao.com>
Revert "fix task starttime in container"

This reverts commit 1bd4cd3b973fd046e547f3c51b209e5de7f79edb
since this patch is rebased to master, not dev.
Merge pull request #16 from RobinDong/dev

Dev
Update README.markdown.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>