From patchwork Tue Nov 4 11:13:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 40130 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 AA9B4240A6 for ; Tue, 4 Nov 2014 11:15:59 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf3943434eek.8 for ; Tue, 04 Nov 2014 03:15:58 -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=4SLcKCsJdBvHPiATVmUVnCMehLkVMKun9nD8JW17sa4=; b=GdBV24OgN2IqXHjwgCggAq32FX7e7WTN+qU8Zh6lU6igG99bFqTe/5gs1GmoGmRqhM yCagycI0yI+t9cc4oJRoFV/DMlIxeQQsmEpY1K+ZvWLSbFGkTQXWZNA/xlZPvgK9mTtS iQwpsLu2AnEPl7mN52WgoYxqg/UVPOtUP/8fmIe4PLL8oSYVxjIvivIrag+EnUx01gXU ZB1TG9UAV++TI5YqJbvFLslQQkgTjYoQYGvbjwfXaY2IHsH8B6xN2pHcQYBLLr7hI8bW r/hjcnIy3dLRtYyD6Wosk1oTe+svz2oSxnnqDGMMTQpGWVx6Jv/4CsHZ8/qf0f0uSjf+ C10w== X-Gm-Message-State: ALoCoQmfSI4WScuthu1KY+08ewA6MEUmi5xwFpu/XglLC9PzfIrW+3ss99C6WFcZqI42C/YvEIJC X-Received: by 10.112.145.200 with SMTP id sw8mr737946lbb.4.1415099758837; Tue, 04 Nov 2014 03:15:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.226 with SMTP id b2ls805022lak.36.gmail; Tue, 04 Nov 2014 03:15:58 -0800 (PST) X-Received: by 10.112.63.70 with SMTP id e6mr20426925lbs.93.1415099758662; Tue, 04 Nov 2014 03:15:58 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id g1si22833lag.126.2014.11.04.03.15.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 03:15:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so13727lbv.19 for ; Tue, 04 Nov 2014 03:15:58 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr58046606lbc.23.1415099758532; Tue, 04 Nov 2014 03:15:58 -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 ew9csp98521lbc; Tue, 4 Nov 2014 03:15:57 -0800 (PST) X-Received: by 10.70.95.162 with SMTP id dl2mr49811078pdb.71.1415099753746; Tue, 04 Nov 2014 03:15:53 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dt17si17699478pdb.181.2014.11.04.03.15.53 for ; Tue, 04 Nov 2014 03:15:53 -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 S1753262AbaKDLPs (ORCPT + 25 others); Tue, 4 Nov 2014 06:15:48 -0500 Received: from mail-pd0-f173.google.com ([209.85.192.173]:38802 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbaKDLPl (ORCPT ); Tue, 4 Nov 2014 06:15:41 -0500 Received: by mail-pd0-f173.google.com with SMTP id v10so13468073pde.4 for ; Tue, 04 Nov 2014 03:15:41 -0800 (PST) X-Received: by 10.66.160.193 with SMTP id xm1mr9659976pab.115.1415099741294; Tue, 04 Nov 2014 03:15:41 -0800 (PST) Received: from wangdeqiang.com ([210.21.223.3]) by mx.google.com with ESMTPSA id ol3sm158568pbb.17.2014.11.04.03.15.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 03:15:40 -0800 (PST) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Steven Rostedt , Juri Lelli , "pang.xunlei" Subject: [PATCH v2 5/6] sched/dl: Optimize select_task_rq_dl() for non-DL curr task Date: Tue, 4 Nov 2014 19:13:04 +0800 Message-Id: <1415099585-31174-5-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1415099585-31174-1-git-send-email-pang.xunlei@linaro.org> References: <1415099585-31174-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.174 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: , When selecting the cpu for a waking DL task, if curr is a non-DL task which is bound only on this cpu, then we can give it a chance to select a different cpu for this DL task to avoid curr starving. Signed-off-by: pang.xunlei --- kernel/sched/deadline.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 7b0b2d2..1f64d4a 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -954,6 +954,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags) struct task_struct *curr; struct rq *rq; + if (p->nr_cpus_allowed == 1) + goto out; + if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK) goto out; @@ -970,11 +973,14 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags) * can!) we prefer to send it somewhere else. On the * other hand, if it has a shorter deadline, we * try to make it stay here, it might be important. + * + * If the current task on @p's runqueue is a non-DL task, + * and this task is bound on current runqueue, then try to + * see if we can wake this DL task up on a different runqueue, */ - if (unlikely(dl_task(curr)) && - (curr->nr_cpus_allowed < 2 || - !dl_entity_preempt(&p->dl, &curr->dl)) && - (p->nr_cpus_allowed > 1)) { + if (unlikely(curr->nr_cpus_allowed < 2) || + unlikely(dl_task(curr) && + !dl_entity_preempt(&p->dl, &curr->dl))) { int target = find_later_rq(p); if (target != -1)