From patchwork Wed Nov 19 15:46:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 41185 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B461241C9 for ; Wed, 19 Nov 2014 15:47:13 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf590215eek.4 for ; Wed, 19 Nov 2014 07:47:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=E+3ix8Nz+Du7UpGSXxamSuufmyEqR6QbHHnQC799sYQ=; b=XzfE3ai5Rx4zya9vK9ASXfG+7jNnVVonT37PXUqvmvgYbDTQ+Kkf4yaMPdDIg3GdDw A8z91i/24Sum8Ex2UImRy7NvNT9xzmvjWuu/5OM9zHs/fRKNXdg+qpeEovd19y0wJA2J oAo1eZftvcusFyNGueCH7q7ioAGpk8ostlj9Fks212YqsOfsuMOxH7lhzHN0is8e8+6B 20hA/+MrMkBWcn3odhOSFP3kRrZFZFInzn49KAtiB/o5/5PTqXzl0j7eU8VvaYJZSQLs r5LeAsQEl8fz7ktjEZlOb4+MkQrgZ883I6ZuGPDqkVdBVeyce0SZk5NYdVcIN5KEbp1O 6AMQ== X-Gm-Message-State: ALoCoQmDDKlN+agA+uh4iFGLD/587bQ+zdqufaBFF+TAmHCiL2yHCXzt1sORFzlwYNW8nkf06quR X-Received: by 10.112.169.68 with SMTP id ac4mr28130lbc.24.1416412032761; Wed, 19 Nov 2014 07:47:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.40 with SMTP id 8ls1482150lar.61.gmail; Wed, 19 Nov 2014 07:47:12 -0800 (PST) X-Received: by 10.112.41.168 with SMTP id g8mr6019762lbl.59.1416412032420; Wed, 19 Nov 2014 07:47:12 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id p7si2132690lah.114.2014.11.19.07.47.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 07:47:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so724701lbv.10 for ; Wed, 19 Nov 2014 07:47:12 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr5886426lbr.74.1416412032076; Wed, 19 Nov 2014 07:47:12 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp105750lbc; Wed, 19 Nov 2014 07:47:11 -0800 (PST) X-Received: by 10.68.68.197 with SMTP id y5mr30634222pbt.82.1416412029583; Wed, 19 Nov 2014 07:47:09 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gy3si933937pac.10.2014.11.19.07.47.08 for ; Wed, 19 Nov 2014 07:47:09 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756135AbaKSPrA (ORCPT + 26 others); Wed, 19 Nov 2014 10:47:00 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:46298 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756065AbaKSPq6 (ORCPT ); Wed, 19 Nov 2014 10:46:58 -0500 Received: by mail-pd0-f174.google.com with SMTP id w10so1084318pde.19 for ; Wed, 19 Nov 2014 07:46:58 -0800 (PST) X-Received: by 10.66.150.164 with SMTP id uj4mr6289575pab.14.1416412018042; Wed, 19 Nov 2014 07:46:58 -0800 (PST) Received: from vptest-PC.zte.com.cn ([167.160.116.27]) by mx.google.com with ESMTPSA id r2sm2136022pdi.60.2014.11.19.07.46.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Nov 2014 07:46:57 -0800 (PST) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , "pang.xunlei" Subject: [PATCH v2 3/4] sched/deadline: add the "set_flag" argument to cpudl_find() Date: Wed, 19 Nov 2014 23:46:21 +0800 Message-Id: <1416411982-1204-3-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1416411982-1204-1-git-send-email-pang.xunlei@linaro.org> References: <1416411982-1204-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The call site of cpudl_find() in check_preempt_equal_dl() doesn't use later_mask, so add this extra argument to distinquish the case. Signed-off-by: pang.xunlei --- kernel/sched/cpudeadline.c | 6 ++++-- kernel/sched/cpudeadline.h | 2 +- kernel/sched/deadline.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index c01b3aa..3047846 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -98,11 +98,12 @@ static inline int cpudl_maximum(struct cpudl *cp) * @cp: the cpudl max-heap context * @p: the task * @later_mask: a mask to fill in with the selected CPUs (not NULL) + * @set_flag: indicate if later_mask should be set * * Returns: int - best CPU (heap maximum if suitable) */ int cpudl_find(struct cpudl *cp, struct task_struct *p, - struct cpumask *later_mask) + struct cpumask *later_mask, int set_flag) { int best_cpu = -1; const struct sched_dl_entity *dl_se = &p->dl; @@ -114,7 +115,8 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, } 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); - cpumask_set_cpu(best_cpu, later_mask); + if (set_flag) + cpumask_set_cpu(best_cpu, later_mask); } out: diff --git a/kernel/sched/cpudeadline.h b/kernel/sched/cpudeadline.h index 4a10a65..a3a85e8 100644 --- a/kernel/sched/cpudeadline.h +++ b/kernel/sched/cpudeadline.h @@ -22,7 +22,7 @@ struct cpudl { #ifdef CONFIG_SMP int cpudl_find(struct cpudl *cp, struct task_struct *p, struct cpumask *later_mask); -void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid); +void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid, int set_flag); int cpudl_init(struct cpudl *cp); void cpudl_set_freecpu(struct cpudl *cp, int cpu); void cpudl_cleanup(struct cpudl *cp); diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 3ecf838..e8208d0 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -976,7 +976,7 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p) * let's hope p can move out. */ if (rq->curr->nr_cpus_allowed == 1 || - cpudl_find(&rq->rd->cpudl, rq->curr, later_mask) == -1) + cpudl_find(&rq->rd->cpudl, rq->curr, later_mask, 0) == -1) return; /* @@ -984,7 +984,7 @@ static void check_preempt_equal_dl(struct rq *rq, struct task_struct *p) * see if it is pushed or pulled somewhere else. */ if (p->nr_cpus_allowed != 1 && - cpudl_find(&rq->rd->cpudl, p, later_mask) != -1) + cpudl_find(&rq->rd->cpudl, p, later_mask, 0) != -1) return; resched_curr(rq); @@ -1190,7 +1190,7 @@ static int find_later_rq(struct task_struct *task) * first, then we can look for a suitable cpu. */ best_cpu = cpudl_find(&task_rq(task)->rd->cpudl, - task, later_mask); + task, later_mask, 1); if (best_cpu == -1) return -1;