aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-08-14Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵v3.10/topic/big.LITTLEMark Brown
lsk-v3.10-big.LITTLE
2014-08-12hmp: Restrict ILB events if no CPU has > 1 taskChris Redpath
Frequently in HMP, the big CPUs are only active with one task per CPU and there may be idle CPUs in the big cluster. This patch avoids triggering an idle balance in situations where none of the active CPUs in the current HMP domain have > 1 tasks running. When packing is enabled, only enforce this behaviour when we are not in the smallest domain - there we idle balance whenever a CPU is over the up_threshold regardless of tasks in case one needs to be moved. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-08-12HMP: Do not fork-boost tasks coming from PIDs <= 2Chris Redpath
System services are generally started by init, whilst kernel threads are started by kthreadd. We do not want to give those tasks a head start, as this costs power for very little benefit. We do however wish to do that for tasks which the user launches. Further, some tasks allocate per-cpu timers directly after launch which can lead to those tasks being always scheduled on a big CPU when there is no computational need to do so. Not promoting services to big CPUs on launch will prevent that unless a service allocates their per-cpu resources after a period of intense computation, which is not a common pattern. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-27Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2014-06-27HMP: use per cpu cpuidle driver to fix deadlock in hmp_idle_pullAlex Shi
Using per cpu cpuidle driver to fix deadlock in hmp_idle_pull. Otherwise a deadlock happened when do bl_idle_init. [ 113.878664] other info that might help us debug this: [ 113.878667] Possible unsafe locking scenario: [ 113.878667] [ 113.878670] CPU0 [ 113.878673] ---- [ 113.878681] lock(cpuidle_driver_lock); [ 113.878684] <Interrupt> [ 113.878691] lock(cpuidle_driver_lock); [ 113.878693] [ 113.878693] *** DEADLOCK *** [ 113.878693] [ 113.878697] 1 lock held by ksoftirqd/4/28: [ 113.878719] #0: (hmp_force_migration){+.....}, at: [<c0054da5>] hmp_idle_pull+0x49/0x508 This patch is just a quick/cheap workaround for cpuidle_driver_lock deadlock. It works for TC2 and any other platform where the idle driver cannot be changed at runtime. Signed-off-by: Alex Shi <alex.shi@linaro.org> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-25Merge remote-tracking branch git://git.linaro.org/arm/big.LITTLE/mp-lsk' ↵Alex Shi
into v3.10/topic/big.LITTLE
2014-06-11sched: hmp: fix out-of-range CPU possibleChris Redpath
If someone hotplugs all the little CPUs while another CPU is handling a wakeup, we can potentially return new_cpu == NR_CPUS from hmp_select_slower_cpu (which is called internally by hmp_best_little_cpu as well). We will use this to deref the per_cpu rq array in hmp_next_down_delay which can go boom. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-05-15Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2014-05-09hmp: dont attempt to pull tasks if affinity doesn't allow itChris Redpath
When looking for a task to be idle-pulled, don't consider tasks where the affinity does not allow that task to be placed on the target CPU. Also ensure that tasks with restricted affinity do not block selecting other unrestricted busy tasks. Use the knowledge of target CPU more effectively in idle pull by passing to hmp_get_heaviest_task when we know it, otherwise only checking for general affinity matches with any of the CPUs in the bigger HMP domain. We still need to explicitly check affinity is allowed in idle pull since if we find no match in hmp_get_heaviest_task we will return the current one, which may not be affine to the new CPU despite having high enough load. In this case, there is nothing to move. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-05-09hmp: Use idle pull to perform forced up-migrationsChris Redpath
When a normal forced up-migration takes place we stop the task to be migrated while the target CPU becomes available. This delay can range from 80us to 1500us on TC2 if the target CPU is in a deep idle state. Instead, interrupt the target CPU and ask it to pull a task. This lets the current eligible task continue executing on the original CPU while the target CPU wakes. Use a pinned timer to prevent the pulling CPU going back into power-down with pending up-migrations. If we trigger for a nohz kick, it doesn't matter about triggering for an idle pull since the idle_pull flag will be set when we execute the softirq and we'll still do the idle pull. If the target CPU is busy, we will not pull any tasks. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-05-09sched: hmp: unify active migration codeChris Redpath
The HMP active migration code is functionally identical to the CFS active migration code apart from one flag check. Share the code and make the flag check optional. Two wrapper functions allow the flag check to be present or not. Thanks to tixy@linaro.org for pointing out the build break and a good solution in an earlier version. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-05-09hmp: sched: Clean up hmp_up_threshold checks into a utility fnChris Redpath
In anticipation of modifying the up_threshold handling, make all instances use the same utility fn to check if a task is eligible for up-migration. This also removes the previous difference in threshold comparison where up-migration used '!<threshold' and idle pull used '>threshold' to decide up-migration eligibility. Make them both use '!<threshold' instead for consistency, although this is unlikely to change any results. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-05-07Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2014-05-07sched: hmp: Change small task packing defaults for all platformsChris Redpath
All platforms other than TC2 default to enabling packing. Since TC2 shows no performance or energy degradation with this feature enabled make it default enabled the same as everyone else. Likewise, vendors have been including TC2 support in multi-machine kernel builds so they expect the default thresholds to remain the same when the TC2 #ifdef is removed. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-04-08Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2014-04-08Revert "hmp: sched: Clean up hmp_up_threshold checks into a utility fn"Jon Medhurst
This reverts commit 765aae26e6e296333c3a5f7a02360f5389dc439a. Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-04-08Revert "sched: hmp: unify active migration code"Jon Medhurst
This reverts commit 0baa5811bacf15b0e76ee85ce29fedffb5136313. Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-04-08Revert "hmp: Use idle pull to perform forced up-migrations"Jon Medhurst
This reverts commit aae7721f20f2520d24a149408a74f18e58f56472. Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-04-08Revert "hmp: dont attempt to pull tasks if affinity doesn't allow it"Jon Medhurst
This reverts commit 5a570cfc01b06906faa8ac67ad7c0c6f278761c4. Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-03-24hmp: dont attempt to pull tasks if affinity doesn't allow itChris Redpath
When looking for a task to be idle-pulled, don't consider tasks where the affinity does not allow that task to be placed on the target CPU. Also ensure that tasks with restricted affinity do not block selecting other unrestricted busy tasks. Use the knowledge of target CPU more effectively in idle pull by passing to hmp_get_heaviest_task when we know it, otherwise only checking for general affinity matches with any of the CPUs in the bigger HMP domain. We still need to explicitly check affinity is allowed in idle pull since if we find no match in hmp_get_heaviest_task we will return the current one, which may not be affine to the new CPU despite having high enough load. In this case, there is nothing to move. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-03-24hmp: Use idle pull to perform forced up-migrationsChris Redpath
When a normal forced up-migration takes place we stop the task to be migrated while the target CPU becomes available. This delay can range from 80us to 1500us on TC2 if the target CPU is in a deep idle state. Instead, interrupt the target CPU and ask it to pull a task. This lets the current eligible task continue executing on the original CPU while the target CPU wakes. Use a pinned timer to prevent the pulling CPU going back into power-down with pending up-migrations. If we trigger for a nohz kick, it doesn't matter about triggering for an idle pull since the idle_pull flag will be set when we execute the softirq and we'll still do the idle pull. If the target CPU is busy, we will not pull any tasks. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-03-24sched: hmp: unify active migration codeChris Redpath
The HMP active migration code is functionally identical to the CFS active migration code apart from one flag check. Share the code and make the flag check optional. Two wrapper functions allow the flag check to be present or not. Thanks to tixy@linaro.org for pointing out the build break and a good solution in an earlier version. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-03-24hmp: sched: Clean up hmp_up_threshold checks into a utility fnChris Redpath
In anticipation of modifying the up_threshold handling, make all instances use the same utility fn to check if a task is eligible for up-migration. This also removes the previous difference in threshold comparison where up-migration used '!<threshold' and idle pull used '>threshold' to decide up-migration eligibility. Make them both use '!<threshold' instead for consistency, although this is unlikely to change any results. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE Conflicts: kernel/irq/irqdesc.c linaro/configs/big-LITTLE-MP.conf
2014-01-22HMP: Drop "sched: Fix sleep time double accounting in enqueue entity"Mark Brown
This reverts commit f0862cb749c537c32de82912d30110098ddc6cd6. Analysis from Vincent Guittot: With the current implementation, the load average statistics of a sched entity change according to other activity on the CPU even if this activity is done between the running window of the sched entity and have no influence on the running duration of the task. When a task wakes up on the same CPU, we currently update last_runnable_update with the return of __synchronize_entity_decay without updating the runnable_avg_sum and runnable_avg_period accordingly. In fact, we have to sync the load_contrib of the se with the rq's blocked_load_contrib before removing it from the latter (with __synchronize_entity_decay) but we must keep last_runnable_update unchanged for updating runnable_avg_sum/period during the next update_entity_load_avg. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-22HMP: Fix rt task allowed cpu mask restriction code on 1x1 systemDietmar Eggemann
There is an error scenario where on a 1x1 HMP system (weight of the hmp_slow_cpu_mask is 1) the short-cut of restricting the allowed cpu mask of an rt tasks leads to triggering a kernel bug in the rt sched class set_cpus_allowed function set_cpus_allowed_rt(). In case the task is on the run-queue and the weight of the required cpu mask is 1 and this is different to the p->nr_cpus_allowed value, this back-end function interprets this in such a way that a task changed from being migratable to not migratable anymore and decrements the rt_nr_migratory counter. There is a BUG_ON(!rq->rt.rt_nr_migratory) check in this code path which triggers in this situation. To circumvent this issue, set the number of allowed cpus for a task p to the weight of the hmp_slow_cpu_mask before calling do_set_cpus_allowed() in __setscheduler(). It will be set to this value in do_set_cpus_allowed() after the call to the sched class related backend function any way. By doing this, set_cpus_allowed_rt() returns without trying to update the rt_nr_migratory counter. This patch has been tested with a test device driver requiring a threaded irq handler on a TC2 system with a reduced cpu mask (1 Cortex A15, 1 Cortex A7). Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22HMP: Restrict irq_default_affinity to hmp_slow_cpu_maskDietmar Eggemann
This patch limits the default affinity mask for all irqs to the cluster of the little cpus. This patch has the positive side effect that an irq thread which has its IRQTF_RUNTHREAD set inside irq_thread() -> irq_wait_for_interrupt() will not overwrite its struct task_struct->cpus_allowed with a full cpu mask of desc->irq_data.affinity in irq_thread_check_affinity() essentially reverting patch "HMP: experimental: Force all rt tasks to start on little domain." for this irq thread. Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched: hmp: Fix potential task_struct memory leakChris Redpath
We use get_task_struct to increment the ref count on a task_struct so that even if the task dies with a pending migration we are still able to read the memory without causing a fault. In the case of non-running tasks, we forgot to decrement the ref count when we are done with the task. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22config: Make packing present on TC2Chris Redpath
The scheduler will default packing to disabled, but this includes the feature so that we can test it more easily. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched: hmp: Change TC2 packing config to disabled default if presentChris Redpath
Since TC2 power curves don't really have a utilisation hotspot where packing makes sense, if it is present for a TC2 system at least make it default to disabled. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched: hmp: Make idle balance behaviour normal when packing disabledChris Redpath
The presence of packing permanently changed the idle balance behaviour. Do not restrict idle balance on the smallest CPUs when packing is present but disabled. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched: update runqueue clock before migrations awayChris Redpath
If we migrate a sleeping task away from a CPU which has the tick stopped, then both the clock_task and decay_counter will be out of date for that CPU and we will not decay load correctly regardless of how often we update the blocked load. This is only an issue for tasks which are not on a runqueue (because otherwise that CPU would be awake) and simultaneously the CPU the task previously ran on has had the tick stopped. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched: reset blocked load decay_count during synchronizationChris Redpath
If an entity happens to sleep for less than one tick duration the tracked load associated with that entity can be decayed by an unexpectedly large amount if it is later migrated to a different CPU. This can interfere with correct scheduling when entity load is used for decision making. The reason for this is that when an entity is dequeued and enqueued quickly, such that se.avg.decay_count and cfs_rq.decay_counter do not differ when that entity is enqueued again, __synchronize_entity_decay skips the calculation step and also skips clearing the decay_count. At a later time that entity may be migrated and its load will be decayed incorrectly. All users of this function expect decay_count to be zero'ed after use. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22genirq: Add default affinity mask command line optionThomas Gleixner
If we isolate CPUs, then we don't want random device interrupts on them. Even w/o the user space irq balancer enabled we can end up with irqs on non boot cpus. Allow to restrict the default irq affinity mask. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22config: Add config fragments for big LITTLE MPJon Medhurst
This patch adds config fragments used to enable most of the features used by big LITTLE MP. This patch is the result of merging the following commits from the Linaro Stable Kernel (LSK) 3.10 tree... Commit 313c69010ed52a7bd52095708049e16c380c8e15 Commit 83952e566d1c41b2e0a70321e9d56cb8162f9a6d Commit c4a782d985da03016e2b15aaef90bfc5cfe426f6 Commit 2732b0467a356e7cc08bf1e0f33481330335657a Commit 7c88e2bd50fc093c96c912090b712b682ae72641 Commit 3231c8ce4b005f79ad27309907adc3de319e341c Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-01-22sched/debug: Add load-tracking statistics to taskKamalesh Babulal
At present we print per-entity load-tracking statistics for cfs_rq of cgroups/runqueues. Given that per task statistics is maintained, it can be used to know the contribution made by the task to its parenting cfs_rq level. This patch adds per-task load-tracking statistics to /proc/<PID>/sched. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20130625080336.GA20175@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org> (cherry picked from commit 939fd731eb88a0cdd9058d0b0143563172a217d7) Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-12-13sched/debug: Add load-tracking statistics to taskKamalesh Babulal
At present we print per-entity load-tracking statistics for cfs_rq of cgroups/runqueues. Given that per task statistics is maintained, it can be used to know the contribution made by the task to its parenting cfs_rq level. This patch adds per-task load-tracking statistics to /proc/<PID>/sched. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20130625080336.GA20175@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-12-13sched: Fix sleep time double accounting in enqueue entityAlex Shi
The woken migrated task will __synchronize_entity_decay(se); in migrate_task_rq_fair, then it needs to set `se->avg.last_runnable_update -= (-se->avg.decay_count) << 20' before update_entity_load_avg, in order to avoid sleep time is updated twice for se.avg.load_avg_contrib in both __syncchronize and update_entity_load_avg. However if the sleeping task is woken up from the same cpu, it miss the last_runnable_update before update_entity_load_avg(se, 0, 1), then the sleep time was used twice in both functions. So we need to remove the double sleep time accounting. Paul also contributed some code comments in this commit. Signed-off-by: Alex Shi <alex.shi@intel.com> Reviewed-by: Paul Turner <pjt@google.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1371694737-29336-5-git-send-email-alex.shi@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-11-22sched: hmp: Fix build breakage when not using CONFIG_SCHED_HMPChris Redpath
hmp_variable_scale_convert was used without guards in __update_entity_runnable_avg. Guard it. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-11-22sched: hmp: Fix build breakage when not using CONFIG_SCHED_HMPChris Redpath
hmp_variable_scale_convert was used without guards in __update_entity_runnable_avg. Guard it. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-21Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2013-11-21Documentation: HMP: Small Task Packing explanationChris Redpath
Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-11-21sched: hmp: add read-only hmp domain sysfs fileChris Redpath
In order to allow userspace to restrict known low-load tasks to little CPUs, we must export this knowledge from the kernel or expect userspace to make their own attempts at figuring it out. Since we now have a userspace requirement for an HMP implementation to always have at least some sysfs files, change the integration so that it only depends upon CONFIG_SCHED_HMP rather than CONFIG_HMP_VARIABLE_SCALE. Fix Kconfig text to match. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-11-21HMP: Avoid using the cpu stopper to stop runnable tasksMathieu Poirier
When migrating a runnable task, we use the CPU stopper on the source CPU to ensure that the task to be moved is not currently running. Before this patch, all forced migrations (up, offload, idle pull) use the stopper for every migration. Using the CPU stopper is mandatory only when a task is currently running on a CPU. Otherwise tasks can be moved by locking the source and destination run queues. This patch checks to see if the task to be moved are currently running. If not the task is moved directly without using the stopper thread. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-10-30arm64: Fix build due to HMP tracepointsMark Brown
Commit 2353c1f800 (arm: ipi raise/start/end tracing) added tracepoints for IPIs in the generic GIC driver but only added definitions for them on ARM, causing build failures on ARM64. Fix this by adding equivalent definitions for arm64. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-10-30smp: Don't use typedef to work around compiler issue with tracepointsMark Brown
Having the typedef in place for the tracepoints causes compiler crashes in some situations. Just using void * directly avoids triggering the issue and should have no effect on the trace. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-10-14arm64: Fix build due to HMP tracepointsMark Brown
Commit 2353c1f800 (arm: ipi raise/start/end tracing) added tracepoints for IPIs in the generic GIC driver but only added definitions for them on ARM, causing build failures on ARM64. Fix this by adding equivalent definitions for arm64. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-10-14smp: Don't use typedef to work around compiler issue with tracepointsMark Brown
Having the typedef in place for the tracepoints causes compiler crashes in some situations. Just using void * directly avoids triggering the issue and should have no effect on the trace. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-10-11Merge branch 'for-lsk' of git://git.linaro.org/arm/big.LITTLE/mp into ↵Mark Brown
lsk-v3.10-big.LITTLE
2013-10-11Merge tag 'big-LITTLE-MP-13.10' into for-lskJon Medhurst