Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbdFBHbo (ORCPT ); Fri, 2 Jun 2017 03:31:44 -0400 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:49355 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbdFBHb1 (ORCPT ); Fri, 2 Jun 2017 03:31:27 -0400 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 165.244.249.26 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: , CC: , , , Subject: [PATCH 1/2] sched/deadline: Add cpudl_maximum_dl() Date: Fri, 2 Jun 2017 16:31:02 +0900 Message-ID: <1496388663-29067-1-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 X-MIMETrack: Itemize by SMTP Server on LGEKRMHUB01/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/06/02 16:31:08, Serialize by Router on LGEKRMHUB01/LGE/LG Group(Release 8.5.3FP6|November 21, 2013) at 2017/06/02 16:31:09, Serialize complete at 2017/06/02 16:31:09 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1616 Lines: 47 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 --- 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 fba235c..d4a6963 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -108,11 +108,16 @@ static void cpudl_heapify(struct cpudl *cp, int idx) cpudl_heapify_down(cp, 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 @@ -131,9 +136,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