From patchwork Thu Nov 6 07:52:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 40257 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE48D240B2 for ; Thu, 6 Nov 2014 07:54:16 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf1390356lab.11 for ; Wed, 05 Nov 2014 23:54:15 -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=yFtlaSGZiY6vZukTLmTeXj5+J5K80d5HnszbqGjpuX8=; b=Svyurpf0hCgLFRkiYRV+URt/8cnhcf1ZaS48sEInGBNVelvyhdtn+PV4d2QAh/Hkp9 MJeJhpLncuLdKhvGCIQxToU/rKfMu2J9wdE/3Z+fLHJuCYYXleeSgRkJlmopx3SEWu1i vZ1M4E/8B4oUSjKSxyMEzrE0L6HqRhzszrvdTWQ8wFLbgDxC486p+WDCZ5XV54+lcjtl KL2KpngVFwpYWJYRPRVSVzHWHm97c72PwGOUZkNvv/O0r7ufzaEZm159KbdzVWiMcAKh VZfZHWfEhlSGG2czDZV7Jn4qSgijTyHISq8WgTelwunNu50vw5yvCvPn/uOGHyzIgKa4 Wv/Q== X-Gm-Message-State: ALoCoQneSlDFTaIMpv5vkNXv5EaKDJwo/jWzO5S7M45pZXTlczW6QairqCuDtZmXPan6MeB3boiv X-Received: by 10.112.77.9 with SMTP id o9mr431878lbw.6.1415260455391; Wed, 05 Nov 2014 23:54:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.226 with SMTP id r2ls59140lal.49.gmail; Wed, 05 Nov 2014 23:54:14 -0800 (PST) X-Received: by 10.112.136.164 with SMTP id qb4mr3081928lbb.62.1415260454835; Wed, 05 Nov 2014 23:54:14 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id y8si10346913laj.5.2014.11.05.23.54.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 23:54:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gq15so2094393lab.7 for ; Wed, 05 Nov 2014 23:54:14 -0800 (PST) X-Received: by 10.112.130.41 with SMTP id ob9mr2987397lbb.74.1415260454408; Wed, 05 Nov 2014 23:54:14 -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 ew9csp8652lbc; Wed, 5 Nov 2014 23:54:13 -0800 (PST) X-Received: by 10.70.35.111 with SMTP id g15mr2489912pdj.155.1415260451944; Wed, 05 Nov 2014 23:54:11 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si5293368pdo.4.2014.11.05.23.54.11 for ; Wed, 05 Nov 2014 23:54:11 -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 S1751800AbaKFHxQ (ORCPT + 25 others); Thu, 6 Nov 2014 02:53:16 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:41301 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751649AbaKFHxM (ORCPT ); Thu, 6 Nov 2014 02:53:12 -0500 Received: by mail-pd0-f178.google.com with SMTP id fp1so670117pdb.9 for ; Wed, 05 Nov 2014 23:53:11 -0800 (PST) X-Received: by 10.68.204.8 with SMTP id ku8mr2558320pbc.103.1415260391418; Wed, 05 Nov 2014 23:53:11 -0800 (PST) Received: from wangdeqiang.com ([210.21.223.3]) by mx.google.com with ESMTPSA id yc4sm5168431pab.27.2014.11.05.23.53.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 23:53:10 -0800 (PST) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , "pang.xunlei" Subject: [PATCH v4 6/7] sched/deadline: Optimize find_later_rq() to select a cache hot cpu Date: Thu, 6 Nov 2014 15:52:06 +0800 Message-Id: <1415260327-30465-6-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1415260327-30465-1-git-send-email-pang.xunlei@linaro.org> References: <1415260327-30465-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.215.48 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: , Add the case for iteration of sched_domains without SD_WAKE_AFFINE flags to select a cpu, this flag may be unset through proc by users. Signed-off-by: pang.xunlei --- kernel/sched/deadline.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index e0e8013..01d3aaab 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1177,6 +1177,7 @@ static int find_later_rq(struct task_struct *task) struct cpumask *later_mask = this_cpu_cpumask_var_ptr(local_cpu_mask_dl); int this_cpu = smp_processor_id(); int cpu = task_cpu(task); + int cachehot_cpu = nr_cpu_ids; /* Make sure the mask is initialized first */ if (unlikely(!later_mask)) @@ -1219,7 +1220,7 @@ static int find_later_rq(struct task_struct *task) rcu_read_lock(); for_each_domain(cpu, sd) { - int best_cpu; + int wakeaffine_cpu; if (sd->flags & SD_WAKE_AFFINE) { /* @@ -1232,16 +1233,24 @@ static int find_later_rq(struct task_struct *task) return this_cpu; } - best_cpu = cpumask_first_and(later_mask, - sched_domain_span(sd)); - if (best_cpu < nr_cpu_ids) { + wakeaffine_cpu = cpumask_first_and(later_mask, + sched_domain_span(sd)); + if (wakeaffine_cpu < nr_cpu_ids) { rcu_read_unlock(); - return best_cpu; + return wakeaffine_cpu; } + } else { + if (cachehot_cpu >= nr_cpu_ids) + cachehot_cpu = cpumask_first_and(later_mask, + sched_domain_span(sd)); } } rcu_read_unlock(); + /* Most likely cache-hot */ + if (cachehot_cpu < nr_cpu_ids) + return cachehot_cpu; + /* * At this point, all our guesses failed, we just return * 'something', and let the caller sort the things out.