Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1607333
| From | Byungchul Park <byungchul.park@lge.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/8] sched/deadline: Add cpudl_maximum_dl() for clean-up |
| Date | 2017-03-23 11:40 +0100 |
| Message-ID | <to8jU-XG-17@gated-at.bofh.it> (permalink) |
| References | <to8jU-XG-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Current code uses cpudl_maximum() to get the root node's cpu, while it
directly accesses the root node using 'cp->elements[0].dl' to get the
root node's dl. It would be better and more readible if a function to
get the dl is added. So add it.
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
kernel/sched/cpudeadline.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 7dd6d9d..f1a6ce4 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -105,11 +105,16 @@ static void cpudl_heapify(struct cpudl_item *e, int size, int idx)
cpudl_heapify_down(e, size, idx);
}
-static inline int cpudl_maximum(struct cpudl *cp)
+static inline int cpudl_maximum_cpu(struct cpudl *cp)
{
return cp->elements[0].cpu;
}
+static inline u64 cpudl_maximum_dl(struct cpudl *cp)
+{
+ return cp->elements[0].dl;
+}
+
/*
* cpudl_find - find the best (later-dl) CPU in the system
* @cp: the cpudl max-heap context
@@ -128,9 +133,9 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) {
best_cpu = cpumask_any(later_mask);
goto out;
- } else if (cpumask_test_cpu(cpudl_maximum(cp), &p->cpus_allowed) &&
- dl_time_before(dl_se->deadline, cp->elements[0].dl)) {
- best_cpu = cpudl_maximum(cp);
+ } else if (cpumask_test_cpu(cpudl_maximum_cpu(cp), &p->cpus_allowed) &&
+ dl_time_before(dl_se->deadline, cpudl_maximum_dl(cp))) {
+ best_cpu = cpudl_maximum_cpu(cp);
if (later_mask)
cpumask_set_cpu(best_cpu, later_mask);
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] sched/deadline: Return the best satisfying affinity and dl in cpudl_find Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 4/8] sched/deadline: Factor out the selecting of suitable max cpu Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 3/8] sched/deadline: Add cpudl_maximum_dl() for clean-up Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 5/8] sched/deadline: Protect read of cpudl heap with a lock Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 2/8] sched/deadline: Re-define parameters of cpudl heapify functions Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 6/8] sched/deadline: Don't return meaningless cpu in cpudl_maximum_cpu() Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 [PATCH 7/8] sched/deadline: Factor out the modifying of cpudl's heap tree Byungchul Park <byungchul.park@lge.com> - 2017-03-23 11:40 +0100 Re: [PATCH 0/8] sched/deadline: Return the best satisfying affinity and dl in cpudl_find Byungchul Park <byungchul.park@lge.com> - 2017-03-23 23:40 +0100 Re: [PATCH 0/8] sched/deadline: Return the best satisfying affinity and dl in cpudl_find Juri Lelli <juri.lelli@arm.com> - 2017-03-27 16:10 +0200
csiph-web