From patchwork Wed Nov 5 15:48:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 40201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D4372404A for ; Wed, 5 Nov 2014 15:50:33 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf659206lab.6 for ; Wed, 05 Nov 2014 07:50:32 -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=q56XF0NEm64ru7Go0aG0SJeKb4bjcICy+8vxMpwSAuA=; b=lig38+I96zVqriKdIP3ycQomRXrfW/Ble1aLFiH6xE5iFh8aJYbRsEk2CjHEoKpfY8 pH59H71Q5nOgxW/XfTVbuwM9tneNIn49c+5E8VYKgPDqI6mQstCA0vSHZ6gpmSfsv7GR bM4CJBzqk5S2FAkHATABZw9P3XVh9c4YYeEEWNGUWg74wlqv7ZDcPDZCTGN4QRV4lcvy bAm1czuOBtppMwF/z58STv7JW43sZZtWoizejpcjFi1f+5sSBqdFnIpkTj7bDsCI1mbV DWEno0OI2jMVsVvliJ69ZBec3h3zWXTjh8aUXnczb3CRoeARtEQOJM2j/rJb2ywZr8Tk efUg== X-Gm-Message-State: ALoCoQk3LZF16uuneju7td+YF2vVrocptkrzLTPNwmE6HmN0TYgcbAxuwCnwZgDxIai0imaOcNIn X-Received: by 10.112.145.200 with SMTP id sw8mr2237640lbb.4.1415202632366; Wed, 05 Nov 2014 07:50:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.39 with SMTP id b7ls907374lae.38.gmail; Wed, 05 Nov 2014 07:50:32 -0800 (PST) X-Received: by 10.112.168.39 with SMTP id zt7mr20271719lbb.72.1415202632062; Wed, 05 Nov 2014 07:50:32 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id bm5si6835528lbb.59.2014.11.05.07.50.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 07:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so903272lam.41 for ; Wed, 05 Nov 2014 07:50:31 -0800 (PST) X-Received: by 10.112.130.41 with SMTP id ob9mr67550143lbb.74.1415202631634; Wed, 05 Nov 2014 07:50:31 -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 ew9csp303560lbc; Wed, 5 Nov 2014 07:50:30 -0800 (PST) X-Received: by 10.68.129.69 with SMTP id nu5mr6356217pbb.51.1415202629494; Wed, 05 Nov 2014 07:50:29 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd13si3288937pdb.188.2014.11.05.07.50.28 for ; Wed, 05 Nov 2014 07:50:29 -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 S1755573AbaKEPt4 (ORCPT + 25 others); Wed, 5 Nov 2014 10:49:56 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:45929 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755055AbaKEPtG (ORCPT ); Wed, 5 Nov 2014 10:49:06 -0500 Received: by mail-pa0-f50.google.com with SMTP id eu11so1031833pac.9 for ; Wed, 05 Nov 2014 07:49:06 -0800 (PST) X-Received: by 10.70.2.226 with SMTP id 2mr58866143pdx.56.1415202546227; Wed, 05 Nov 2014 07:49:06 -0800 (PST) Received: from vptest-PC.zte.com.cn ([167.160.116.59]) by mx.google.com with ESMTPSA id e9sm3517098pdp.59.2014.11.05.07.49.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Nov 2014 07:49:05 -0800 (PST) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Steven Rostedt , Juri Lelli , "pang.xunlei" Subject: [PATCH v3 5/7] sched/deadline: Optimize find_later_rq() to select a cache hot cpu Date: Wed, 5 Nov 2014 23:48:24 +0800 Message-Id: <1415202506-7800-5-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1415202506-7800-1-git-send-email-pang.xunlei@linaro.org> References: <1415202506-7800-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.54 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 42edfcd..ddb6185 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1165,6 +1165,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)) @@ -1209,7 +1210,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) { /* @@ -1222,16 +1223,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.