From patchwork Wed May 24 05:29:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100413 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115483qge; Tue, 23 May 2017 22:31:08 -0700 (PDT) X-Received: by 10.99.126.67 with SMTP id o3mr36000477pgn.36.1495603868328; Tue, 23 May 2017 22:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495603868; cv=none; d=google.com; s=arc-20160816; b=IfDUigU05b2dtxZobfUmMKrofTpmSLEJX/bqM9ViWUtD75LrJCL4jCVrmlpqD8jJNd tOOxGacJGFH3dji5jhtJlw7jmNAe7xvCn4Qc87/WX9tyHQbWGddoT4wVxb+yIda/zza8 x51+6xd132BPXLrbj36tuE66IwPk0/aMSbs7X97X9hROczKTI4gmhujXHlUwkDlqnxxi UWKzA+v6B41yr767UJgDoLFPXs+KF3a4ljvkSDVBjnrhitM6vN6MoPBmacRI2yamLzwc zPjzCTl4w2d6N4gyvi3hPegFPcf8PlVVQcCs9dRgppJ8hqQ/8vf5yGR4n4tmh3p2mxf7 w4CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9rcluLe462+XjCXOeaalLOAV0rhvsA8xyXyH4YVeAm0=; b=OGOU90LG0FvRXqynZwhca7+24x7qDfHjUaasERlE+51JNwPyOk6ihzzubdg0yP+8Dc 9nUeg4WatUPQiAif/J/62GTWouBzILSHkraySWXU6aYqtBjreKtXqT//Vkzw8OEKUsm1 53OIMRN+uPrmSN6BdvACy/PyAS7Vhp4tHEHCxJr5Ni+CGvMn5PLZrAcnMhQ9Ge62ydAf sLt1GwLj8mCL/S9MnCw0cpF05h0rFE6d9vb0y9Z045wriyiVsh5PbGU79At9vS6pOHev pLCy+zOOU2Qpsq8dTAL4hOfKYQhs/R/lwOJPSD9SLsFY/tOhPbs5MlKvs5+HLh80eiW3 f5Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si22954419pfk.341.2017.05.23.22.31.07; Tue, 23 May 2017 22:31:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969225AbdEXFbF (ORCPT + 25 others); Wed, 24 May 2017 01:31:05 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33572 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969206AbdEXFar (ORCPT ); Wed, 24 May 2017 01:30:47 -0400 Received: by mail-pf0-f171.google.com with SMTP id e193so133686593pfh.0 for ; Tue, 23 May 2017 22:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9rcluLe462+XjCXOeaalLOAV0rhvsA8xyXyH4YVeAm0=; b=TZsjg5YpnUKATfWyK2PBUKLyr2SKLlT0+IegRhJgTaPqCyL75MkjwUdptt7oCh0l4B 3hcw0inhDq/pbXIDwzswlzvXiOHi9Q738YUuOwbH3BkodUbECpNXVCMx6bwID5wAQuD2 +jsH9zbhb4UagJPAioGZc8oAwnicoQFvbekno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=9rcluLe462+XjCXOeaalLOAV0rhvsA8xyXyH4YVeAm0=; b=jn7+/L1DFIncfHB9zVbdgjVp4XoKWxtG67qPINgcULJkj4IntaivJsjx4K30HBcXJV RgNNTC0fcbcJExZyWgNY9CbFoE2/Cn27VKq6nQQpnBAP7nODCUak7BZWRia9llUfYzeq 4NG070x5jGablGbWa93L4FgOaR2TtAPHnPldEeFbi9jloVDZRRDcT3KrFnNyarRZIHRA OO/qy/eiKeq8DFI+4vg5ciGmi9pjS3R17/+l8ZHSc9wNeELG3Vj+AT2GDDAlOJkxrIWh Ewdn1L3Kfu7rRCHhI6H3o6SGm0h/BaqNvJqaecdmbVM4zgGGlJY4bRJVNNebV8JGg5JC sHqA== X-Gm-Message-State: AODbwcDa3gjvjICVtBksjjfzOOKWz3eQfmUPG1SQpD1Ucp2xIyTuZ9kX KgKPX2nXt5c+2nqv X-Received: by 10.98.83.132 with SMTP id h126mr3351276pfb.214.1495603827241; Tue, 23 May 2017 22:30:27 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id 80sm4572860pfl.89.2017.05.23.22.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 22:30:26 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 2/6] sched: Reuse put_prev_task() Date: Wed, 24 May 2017 10:59:53 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reuse put_prev_task() instead of copying its implementation. Signed-off-by: Viresh Kumar --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.0.70.g6367777092d9 diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a8366cfebd31..8ddebb068585 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5683,7 +5683,7 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf) */ next = pick_next_task(rq, &fake_task, rf); BUG_ON(!next); - next->sched_class->put_prev_task(rq, next); + put_prev_task(rq, next); /* * Rules for changing task_struct::cpus_allowed are holding From patchwork Wed May 24 05:29:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100412 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115397qge; Tue, 23 May 2017 22:30:57 -0700 (PDT) X-Received: by 10.99.97.68 with SMTP id v65mr36622350pgb.76.1495603857050; Tue, 23 May 2017 22:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495603857; cv=none; d=google.com; s=arc-20160816; b=eTTQJIGkhndXj9FZeJyXGn0mFDSY+0rI0EnTrlEEl6WhG7N6GjZbSQxDDnY4wPn1Wo 8TAykYVlx15fKLNRy/y56B45F2CRnMGW6ctUI8P0uyiIVlw+6TwkaK5Ww+p73QspYCS1 +2CLpZhNRXheTha8+v5xUNvTZ8n4Evc1LolTXMbdyAo9Inl2E+45gAoIGb66/NatFpoO t12vjZOK453Blkwiwof9K0KXyBm3NbtUQ7DTsZl6J0k5w0Alfw7/XuHsW1W/TZYhh86G wYdlVObdtn/agvVr2/ngWpr8ZGBMCHgPYxIorGf8yMA+DMKa2aRhKz5ooNydmuVKAbsL j58g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HJ6JH1I3dFqsa2dVOTAavMho2xFcyaeh7tg/FXhFaeM=; b=Sb8vC/mMEJwPpKoUVY5vFaNkriQ8rn3ZXLP7jIi4QC5Lwu3KHxQudbJS3Ahi1UKhZu r1CURausPY8jK8ZTfHzB3dIZMKvT4dW6ldC8pp/WXSLTEuJy2WFys+SPWDD3e8jqcJIM JdfXPbx/BLvZ+f7BXMpuYAL1iOhrk2Ra6EpvekXZq8tNW1u5mirOktkQA791ZRf67cI0 Ek44F5Zb+g5PCYmx/48IPGoejx0MsesUPPWPuN9TjRxaNPqs5rtIEdZjt67rW6YojjgW NXaEYpmPNwKru3mKiqk9nzxAwSp6CSayOKis1KEP15KSOZbU6D9plNwTsF3LEXYTQv/8 26Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si22954419pfk.341.2017.05.23.22.30.56; Tue, 23 May 2017 22:30:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969210AbdEXFat (ORCPT + 25 others); Wed, 24 May 2017 01:30:49 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:34147 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966192AbdEXFag (ORCPT ); Wed, 24 May 2017 01:30:36 -0400 Received: by mail-pf0-f177.google.com with SMTP id 9so133523660pfj.1 for ; Tue, 23 May 2017 22:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=HJ6JH1I3dFqsa2dVOTAavMho2xFcyaeh7tg/FXhFaeM=; b=BFfRWE1AozJKcNds+a/iGOVXGkd5wG3SllbzUai5EM1VEMjp8JkKK0Od5T2Q5iY+S+ fpDEQGtHDxR8Qbp5eVpRB5muVsEOh70lI9ZTukwTzeKgBGDPM19BnirkSESccDOpCLZ9 I+EvR4WtP4DBsSohJ3AVePveUxkCoWwR/moIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=HJ6JH1I3dFqsa2dVOTAavMho2xFcyaeh7tg/FXhFaeM=; b=CBvuNVnIUT9bEThMEsKcwTVBM/3FUapGh/fXE71Knzo8K7OnBae5dHv+keUOLW5LXe rCMtri8nX0I+kBb1k/epGjqJGC348OJ533vhA61Dv3Lb23M1QoAyMy03yYARKiS5Dx+w aL+XlJ1h9Ul0I3x2NSfUm9KpBVySe5I9tfWXVaK8J7ZZ5dAIvMf6nl8FkagEEtlVu7b3 GbA8+dCCZGSZM/1u35alsyQstK+oe85d/k9K2Br4qYbQkXNElU1evwR9wfZ2Fu6O1Pfb QRIq/PqhqjObmr/SXase1ds36s082Ao2XZpGLCaATF9HfnmiycAK0qSmObjxguWbQqnL Ifyg== X-Gm-Message-State: AODbwcD2ybdadcxjT0Bvfi17+lre/m1u/CW2OVopC0lbT8K6a8SjjvBr eKTImIcBD5tyFPn8CKvWNQ== X-Received: by 10.98.153.4 with SMTP id d4mr19035307pfe.223.1495603830149; Tue, 23 May 2017 22:30:30 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id o10sm4096720pge.67.2017.05.23.22.30.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 22:30:29 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 3/6] sched: fair: Pass rq to weighted_cpuload() Date: Wed, 24 May 2017 10:59:54 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org weighted_cpuload() uses the cpu number passed to it get pointer to the runqueue. Almost all callers of weighted_cpuload() already have the rq pointer with them and can send that directly to weighted_cpuload(). In some cases the callers actually get the CPU number by doing cpu_of(rq). It would be simpler to pass rq to weighted_cpuload(). Signed-off-by: Viresh Kumar --- kernel/sched/fair.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) -- 2.13.0.70.g6367777092d9 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a0a97497c400..fe03efd3880a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1378,7 +1378,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, group_faults_cpu(ng, src_nid) * group_faults(p, dst_nid) * 4; } -static unsigned long weighted_cpuload(const int cpu); +static unsigned long weighted_cpuload(struct rq *rq); static unsigned long source_load(int cpu, int type); static unsigned long target_load(int cpu, int type); static unsigned long capacity_of(int cpu); @@ -1410,7 +1410,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid) struct rq *rq = cpu_rq(cpu); ns->nr_running += rq->nr_running; - ns->load += weighted_cpuload(cpu); + ns->load += weighted_cpuload(rq); ns->compute_capacity += capacity_of(cpu); cpus++; @@ -5064,9 +5064,9 @@ static void cpu_load_update(struct rq *this_rq, unsigned long this_load, } /* Used instead of source_load when we know the type == 0 */ -static unsigned long weighted_cpuload(const int cpu) +static unsigned long weighted_cpuload(struct rq *rq) { - return cfs_rq_runnable_load_avg(&cpu_rq(cpu)->cfs); + return cfs_rq_runnable_load_avg(&rq->cfs); } #ifdef CONFIG_NO_HZ_COMMON @@ -5111,7 +5111,7 @@ static void cpu_load_update_idle(struct rq *this_rq) /* * bail if there's load or we're actually up-to-date. */ - if (weighted_cpuload(cpu_of(this_rq))) + if (weighted_cpuload(this_rq)) return; cpu_load_update_nohz(this_rq, READ_ONCE(jiffies), 0); @@ -5132,7 +5132,7 @@ void cpu_load_update_nohz_start(void) * concurrently we'll exit nohz. And cpu_load write can race with * cpu_load_update_idle() but both updater would be writing the same. */ - this_rq->cpu_load[0] = weighted_cpuload(cpu_of(this_rq)); + this_rq->cpu_load[0] = weighted_cpuload(this_rq); } /* @@ -5148,7 +5148,7 @@ void cpu_load_update_nohz_stop(void) if (curr_jiffies == this_rq->last_load_update_tick) return; - load = weighted_cpuload(cpu_of(this_rq)); + load = weighted_cpuload(this_rq); rq_lock(this_rq, &rf); update_rq_clock(this_rq); cpu_load_update_nohz(this_rq, curr_jiffies, load); @@ -5174,7 +5174,7 @@ static void cpu_load_update_periodic(struct rq *this_rq, unsigned long load) */ void cpu_load_update_active(struct rq *this_rq) { - unsigned long load = weighted_cpuload(cpu_of(this_rq)); + unsigned long load = weighted_cpuload(this_rq); if (tick_nohz_tick_stopped()) cpu_load_update_nohz(this_rq, READ_ONCE(jiffies), load); @@ -5192,7 +5192,7 @@ void cpu_load_update_active(struct rq *this_rq) static unsigned long source_load(int cpu, int type) { struct rq *rq = cpu_rq(cpu); - unsigned long total = weighted_cpuload(cpu); + unsigned long total = weighted_cpuload(rq); if (type == 0 || !sched_feat(LB_BIAS)) return total; @@ -5207,7 +5207,7 @@ static unsigned long source_load(int cpu, int type) static unsigned long target_load(int cpu, int type) { struct rq *rq = cpu_rq(cpu); - unsigned long total = weighted_cpuload(cpu); + unsigned long total = weighted_cpuload(rq); if (type == 0 || !sched_feat(LB_BIAS)) return total; @@ -5229,7 +5229,7 @@ static unsigned long cpu_avg_load_per_task(int cpu) { struct rq *rq = cpu_rq(cpu); unsigned long nr_running = READ_ONCE(rq->cfs.h_nr_running); - unsigned long load_avg = weighted_cpuload(cpu); + unsigned long load_avg = weighted_cpuload(rq); if (nr_running) return load_avg / nr_running; @@ -5651,7 +5651,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) shallowest_idle_cpu = i; } } else if (shallowest_idle_cpu == -1) { - load = weighted_cpuload(i); + load = weighted_cpuload(cpu_rq(i)); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; least_loaded_cpu = i; @@ -7439,7 +7439,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->nr_numa_running += rq->nr_numa_running; sgs->nr_preferred_running += rq->nr_preferred_running; #endif - sgs->sum_weighted_load += weighted_cpuload(i); + sgs->sum_weighted_load += weighted_cpuload(rq); /* * No need to call idle_cpu() if nr_running is not 0 */ @@ -7968,7 +7968,7 @@ static struct rq *find_busiest_queue(struct lb_env *env, capacity = capacity_of(i); - wl = weighted_cpuload(i); + wl = weighted_cpuload(rq); /* * When comparing with imbalance, use weighted_cpuload() From patchwork Wed May 24 05:29:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100411 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115393qge; Tue, 23 May 2017 22:30:56 -0700 (PDT) X-Received: by 10.99.113.20 with SMTP id m20mr35548262pgc.120.1495603856665; Tue, 23 May 2017 22:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495603856; cv=none; d=google.com; s=arc-20160816; b=SzyX513G56KX3Mm0l1KOSccsKmMNePcM//bY6vE3EVPLNFzPxidf9SkX5I+aiLU5U1 wUvFLJuMFaPS555hRFMeNQ6ZVOi8etuZxFDrhG2xWkoBnFCiUbkQzwpWVq2xzAYzDx9c DbfYZ4qMxVzIZO5z8meICVvjcZa07fMCyPiS9QSo+C3NvO091V+uLxD16YmH3rgBZEMi Sue5FA2gjUALCdP6MxdLdR+NXMR5D36mjJKcP8zmDbdrtwFRhD7B23ePgBLUjg8VeqZM adzeunYf8inNu+wPiiuvFNRhRRnCwX9A3w4JG5J1D0piLp1tjTpfrGM8dCrPsZR6u16N JI0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CrHRfAg7ZFyIP3lZSA1spmAraA3VAxvHRhYzWo3opTg=; b=e6PWAruhOQQT8HQ3nyiKItlJOLQh05jsVv5MT0r+N+oQq3ESRriu7EAxuoxPXBRh6C lbU1n0CqBmKjU4Umq3CZ3bwZH70yOGQUQBP/f+ZneuXuubZRFN+2h4imdEkPwfI0/W+m XTcdquinRUq0ZOKZbG7dyHYubaaU/PSQDcNjqYVGbSZB6PMYIBcSZ3fC9xkyzjWwfywv KfKCKCuGr8Xyj1LdFOGMkWdO7SoJL5BJVR2VTRF+F3toaHfsBG/cn+MpXU7UVgCN4scs rtK3r6KY84Z2BYavpoWh01RvZyXjvOpTMl53mZbPzudR31+x2GTXri4JJXkK9ZbA/vIT O3Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si22954419pfk.341.2017.05.23.22.30.56; Tue, 23 May 2017 22:30:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969145AbdEXFam (ORCPT + 25 others); Wed, 24 May 2017 01:30:42 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34159 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966142AbdEXFad (ORCPT ); Wed, 24 May 2017 01:30:33 -0400 Received: by mail-pf0-f182.google.com with SMTP id 9so133524229pfj.1 for ; Tue, 23 May 2017 22:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=CrHRfAg7ZFyIP3lZSA1spmAraA3VAxvHRhYzWo3opTg=; b=G/y7X+Uyk/ISSH85Wyr8jyJ5NE02eFD7M00nwlEb62nONEBafjrDcGuhW4uBEEbOxj GQU78a4vFP7JiwhyZMA3BqcMIWI2TKeLepKW+T+3uN8XCXNxjFlDKwtiolEg99GdPn1h cg7diQ4UoDz7RLhnUVq2Zb5AxOT7pyKHk5dA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=CrHRfAg7ZFyIP3lZSA1spmAraA3VAxvHRhYzWo3opTg=; b=BHDdD6t7xoWDhrKT1iReCkPfATBwj9UaULNKpsB0hDqVICirFGQgUZsp8i0qpytIZV 41kE2H6IoAxh07dw4FbY1sGNOa/hTNE/gXsO/jWq1ZkMKxw2uFXyPELwlr3wVs5OJ5ih VCDor2yGwkqjlKfmVcKmBYE+y0JsqHGJfMd3QTtnxFGMOdMkT3YF2TW2Hne7+trCb23x cuZzPzBqW6uSjmRECBsmN0W8rUMrv02bCTImRhtbCqsSvHM7NAoO4aCtbyxDz35vpqjz 2DKxI/rCRxPW+1eZ6ZspuZo9l/gZUBablBHgUmsnOCeSrx+P9fhzinUUGbgxnVhdH7MP UYpQ== X-Gm-Message-State: AODbwcDjOV02aPjm8KJxBRRwIWN2KaAVRgYSjAMZe2rQf1En5ukKclTx dSs1aLOZ7D11CDN7 X-Received: by 10.98.198.72 with SMTP id m69mr36887812pfg.169.1495603833047; Tue, 23 May 2017 22:30:33 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id j82sm1179248pfj.69.2017.05.23.22.30.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 22:30:32 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 4/6] sched: fair: Avoid checking cfs_rq->nr_running twice Date: Wed, 24 May 2017 10:59:55 +0530 Message-Id: <000903ab3df3350943d3271c53615893a230dc95.1495603536.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rearrange pick_next_task_fair() a bit to avoid checking cfs_rq->nr_running twice for the case where FAIR_GROUP_SCHED is enabled and the previous task doesn't belong to the fair class. Signed-off-by: Viresh Kumar --- kernel/sched/fair.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.13.0.70.g6367777092d9 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fe03efd3880a..e519f6c03fe9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6267,10 +6267,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf int new_tasks; again: -#ifdef CONFIG_FAIR_GROUP_SCHED if (!cfs_rq->nr_running) goto idle; +#ifdef CONFIG_FAIR_GROUP_SCHED if (prev->sched_class != &fair_sched_class) goto simple; @@ -6300,11 +6300,17 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf /* * This call to check_cfs_rq_runtime() will do the * throttle and dequeue its entity in the parent(s). - * Therefore the 'simple' nr_running test will indeed + * Therefore the nr_running test will indeed * be correct. */ - if (unlikely(check_cfs_rq_runtime(cfs_rq))) + if (unlikely(check_cfs_rq_runtime(cfs_rq))) { + cfs_rq = &rq->cfs; + + if (!cfs_rq->nr_running) + goto idle; + goto simple; + } } se = pick_next_entity(cfs_rq, curr); @@ -6344,12 +6350,8 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf return p; simple: - cfs_rq = &rq->cfs; #endif - if (!cfs_rq->nr_running) - goto idle; - put_prev_task(rq, prev); do { From patchwork Wed May 24 05:29:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100415 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115680qge; Tue, 23 May 2017 22:31:54 -0700 (PDT) X-Received: by 10.98.153.153 with SMTP id t25mr36574429pfk.160.1495603914540; Tue, 23 May 2017 22:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495603914; cv=none; d=google.com; s=arc-20160816; b=cnQ78yrU6FaZmy64mcCjjcXVoWRGPxsArLzY/UZPRaVbBozYVDzV1AadGz6x7D1XvV aC2PRdO65WfY/h01C0g/gGNy3KHfyOQ5yUB79zOnJie3hXKb6azxH9wTJ2n+1f2+1/5f f42h2ZlY08rREhJIxtSzc8Avie8mbiKyrxWpQieugh4e6r6V6Vub1cHF9dICTkmIjgbe LcO3Cl/9ysFK566TkZdl/nD47o+3FJl0cTVcznUocUAjgwdYoRumCDXDamAVpRT30tLN gJDciyPGD+Lw4ts2hB3Ag1N+pLoQfQtZmc9YzRleAg67SWm55hJcBdk9K2y1qHoAm6Bd sTeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=iq1b03fDVvJe1IzucGoOqCE1UZWcVbrUgCjlnuuWnQg=; b=F+ZnD2GgqyENLZ/bbO1GXa9sKguiV21Qc0oRxdICPfodVIuChWXeI9y6KGThPPkZeq jWafkaenKnSmcMet2oh7iF/KuPX7z/S+3kujAaMJcNOoBZ7D+rpyOhFrrYAykN2RhPXC LHKIINLGGq56CWFsZKWSihFhkrDJPnNdnL7fbKH2/BZGaYzuHRgl3uW2diaTly36G5uV oASAsLwaifnCzmPc7AyGVDD2RtAAI/aQoxLqXDtBSF6ejwm8twc0e6iydfSUFTenNQWI A6Lk0WtN2UUa3e+o+ShpIsBB8JlX2XeUW5V2Faz5vlpvKPEWiQlRwx4hNNWuMNoGEUw7 WRng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si23856640pli.166.2017.05.23.22.31.54; Tue, 23 May 2017 22:31:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969247AbdEXFbq (ORCPT + 25 others); Wed, 24 May 2017 01:31:46 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34172 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966203AbdEXFah (ORCPT ); Wed, 24 May 2017 01:30:37 -0400 Received: by mail-pf0-f178.google.com with SMTP id 9so133524840pfj.1 for ; Tue, 23 May 2017 22:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=iq1b03fDVvJe1IzucGoOqCE1UZWcVbrUgCjlnuuWnQg=; b=D/Vt5h1BhG99FnbJn3d1noC5Oja401/prc7G1W4oJWYIpil9GjlLGB6gKVjXRcZiJd VdgOLjXRfnOTlmvtxT9PAFHnN88wRCeouW0fuzoapEa2X6J7bxZk0CT9kxsPScSFZyY1 NsjlxJmpZ/Jt/yuQgInj89l47VlxqOgpl/gxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=iq1b03fDVvJe1IzucGoOqCE1UZWcVbrUgCjlnuuWnQg=; b=QBmLq/Yuc+WLgfkgZ1TLa69JRgeXiyqp/8oDi44wyYGK2LhyvAya8ZdjTqL+eeK0St 079cJqJEKdlL9YgvA4R6dqCgjaYQZPtZ+vrEAvWU0lO/hbdJB+45X2IMT+QytRWFksdU 2WsRon0tvNQ9ZHPOyXIiQQIhrs+WLK/uPIVcZPYj5FYTa09nefw9LT349j/sEaWTSVNS gzGqnUOLrooHB7Dkq1nDG4GPXG9EafcQJjRA8I70CZPSUpzO3TFkIdqsEh1iUmVFIifx BvblBzjBaY6BRlZ09p3Q9YDW5bwO5b+5exlWtk2z6Os0NCKCtK1r5DSdUTIcR+ThDC16 NDPw== X-Gm-Message-State: AODbwcCg+3LxPH41jMXvKcYAMp3yLJOG2axW/7YuO03bYZhTL1jsGh7Z r24fTLiG3jwaYAnQ X-Received: by 10.99.163.25 with SMTP id s25mr6682748pge.191.1495603836055; Tue, 23 May 2017 22:30:36 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id 184sm5946262pgd.12.2017.05.23.22.30.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 22:30:35 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 5/6] sched: fair: Drop always true parameter of update_cfs_rq_load_avg() Date: Wed, 24 May 2017 10:59:56 +0530 Message-Id: <2d28d295f3f591ede7e931462bce1bda5aaa4896.1495603536.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org update_freq is always true and there is no need to pass it to update_cfs_rq_load_avg(). Remove it. Signed-off-by: Viresh Kumar --- kernel/sched/fair.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.13.0.70.g6367777092d9 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e519f6c03fe9..89d61d09d083 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -806,7 +806,7 @@ void post_init_entity_util_avg(struct sched_entity *se) /* * For !fair tasks do: * - update_cfs_rq_load_avg(now, cfs_rq, false); + update_cfs_rq_load_avg(now, cfs_rq); attach_entity_load_avg(cfs_rq, se); switched_from_fair(rq, p); * @@ -3259,7 +3259,6 @@ static inline void set_tg_cfs_propagate(struct cfs_rq *cfs_rq) {} * update_cfs_rq_load_avg - update the cfs_rq's load/util averages * @now: current time, as per cfs_rq_clock_task() * @cfs_rq: cfs_rq to update - * @update_freq: should we call cfs_rq_util_change() or will the call do so * * The cfs_rq avg is the direct sum of all its entities (blocked and runnable) * avg. The immediate corollary is that all (fair) tasks must be attached, see @@ -3273,7 +3272,7 @@ static inline void set_tg_cfs_propagate(struct cfs_rq *cfs_rq) {} * call update_tg_load_avg() when this function returns true. */ static inline int -update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq) +update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) { struct sched_avg *sa = &cfs_rq->avg; int decayed, removed_load = 0, removed_util = 0; @@ -3301,7 +3300,7 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq) cfs_rq->load_last_update_time_copy = sa->last_update_time; #endif - if (update_freq && (decayed || removed_util)) + if (decayed || removed_util) cfs_rq_util_change(cfs_rq); return decayed || removed_load; @@ -3329,7 +3328,7 @@ static inline void update_load_avg(struct sched_entity *se, int flags) if (se->avg.last_update_time && !(flags & SKIP_AGE_LOAD)) __update_load_avg_se(now, cpu, cfs_rq, se); - decayed = update_cfs_rq_load_avg(now, cfs_rq, true); + decayed = update_cfs_rq_load_avg(now, cfs_rq); decayed |= propagate_entity_load_avg(se); if (decayed && (flags & UPDATE_TG)) @@ -3473,7 +3472,7 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf); #else /* CONFIG_SMP */ static inline int -update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq) +update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) { return 0; } @@ -6995,7 +6994,7 @@ static void update_blocked_averages(int cpu) if (throttled_hierarchy(cfs_rq)) continue; - if (update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, true)) + if (update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq)) update_tg_load_avg(cfs_rq, 0); /* Propagate pending load changes to the parent, if any: */ @@ -7068,7 +7067,7 @@ static inline void update_blocked_averages(int cpu) rq_lock_irqsave(rq, &rf); update_rq_clock(rq); - update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, true); + update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq); rq_unlock_irqrestore(rq, &rf); } From patchwork Wed May 24 05:29:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 100414 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp115635qge; Tue, 23 May 2017 22:31:42 -0700 (PDT) X-Received: by 10.84.253.23 with SMTP id z23mr41516518pll.11.1495603902064; Tue, 23 May 2017 22:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495603902; cv=none; d=google.com; s=arc-20160816; b=fjc8cy1zSEYDFTdyX2yTrw72JSmcnMh9SffOAMkiLGt7dBJ66HWT+9VkT5HSOwaAPm svsvFjY/ca4CN1sWNbz4l+Xa5pjrPVWAHCcROymXB0KJrLd4aEIzlnLkjTB/9gRqsnLI fnsQGw4hlTRCxH8AqdfKYcZIRE4vSr7LLQBObMtj30UKLfZs2CNu7i2+36NQBo1VghZ/ d0tLopg28y0Dlq6mwXnDQ2SWKQXbF7NLMBtXFcVRf5kGpFprnforj6pHLvAPu+83AfTD 7ADlho/2b4byEgguqb+J4GHAyLsu19AreCYp7Ld3WCG1cOPXxxx0dDXczEYN5thEgWdi nkOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=35bb7eAf/rdwfVjY20K2jI2v2/ihJTvaU01n6l626tM=; b=gzCsKHPoEG9R0ItxMYd2ltNobT0KmgAXKHnmR3U6Kv9AJMOv+v27SvOPVFeOotqEmP 7OoaFjVdv2R2HsC1TXonmorNYSMsx1tGZjbfXEiUzIHhGt8nzXO7c0d9dKAz4dH8oYuq D0LIPOGLaN4a7scg0a7/Hn5fmOYmJKXF6vozgcZmA9FTjFzxU0stjtbsxnO1K6asSpJx p4Ww7owJpp9uXlNL48qc6sl5fw3+BIHoh9KeGpvKFxYhIqW79L3U54gnYi927HZnyNKb cD3g2vz2iRwSxO+Kdb6wPUlLOM4d9FShVeFoPRQtgcnFhXN0PJJbPeCIs4jVbRc83TG7 Enmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h82si23535430pfa.305.2017.05.23.22.31.41; Tue, 23 May 2017 22:31:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969239AbdEXFb2 (ORCPT + 25 others); Wed, 24 May 2017 01:31:28 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:32998 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969156AbdEXFao (ORCPT ); Wed, 24 May 2017 01:30:44 -0400 Received: by mail-pg0-f41.google.com with SMTP id u187so60157604pgb.0 for ; Tue, 23 May 2017 22:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=35bb7eAf/rdwfVjY20K2jI2v2/ihJTvaU01n6l626tM=; b=UE9gsy/YpWFxAEOhf9QpRoyfTaacXBt7mgIsrmm0V69MNAOcu0qmdFrjMExRqnS8kK 39jqqKTagqZXUiEC1AeGyVdikVMAf8LzxT3bC3RQ4cFnickmSCgROkXZxA928bwj7x/Z RZVljQ84xITKP/35hMI11D+vq3nBeL93EpC5o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=35bb7eAf/rdwfVjY20K2jI2v2/ihJTvaU01n6l626tM=; b=HJktD8ZlWzAwERFYGhMqL3ZKK59CL5XhQ3xxOYyaxu1xMbvqaQcTAMwidJAW9ExOfm xHEYhsDAlUqh2wQyD+2/8jK041kWM0NDD6GvlWiUHU7bU6io3GiaBvS3/pRGIdpklZ+C YvPcrN+kimADzWQVNvjTEDM0AVeoMF6SPt4VWDo/UmSOC37dmFGjaTuti59arWs5nZvS I52WD8ihvZmbtMsgYC5BWZmsbH4A7u8CHgwgs2ohWVtkEJ90dY/TVnPapJY1UGRn1Nwk UVN3of2NpFAHUeDQA1halyIm2ijG6EvAapWLnlXBKXi17sxq7dvdrcv3F31PMIhoAIRK 3KwA== X-Gm-Message-State: AODbwcDHymDXWAVyjnX9Dg4u5PfWEzvBEx7cudDHrDSIhj3U5LMBE7xP MwfRGnUTuDe1Hs58 X-Received: by 10.98.211.87 with SMTP id q84mr36513811pfg.126.1495603838963; Tue, 23 May 2017 22:30:38 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id l7sm5267490pgn.10.2017.05.23.22.30.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 22:30:38 -0700 (PDT) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot Subject: [PATCH 6/6] sched: cpufreq: Optimize cpufreq_update_this_cpu() a bit Date: Wed, 24 May 2017 10:59:57 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org smp_processor_id() can result in a function call if CONFIG_DEBUG_PREEMPT is enabled. It would be much straight forward to use this_rq() macro instead. Signed-off-by: Viresh Kumar --- kernel/sched/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.0.70.g6367777092d9 diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index bcdf6a136c59..4220ec76d643 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1995,7 +1995,7 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) static inline void cpufreq_update_this_cpu(struct rq *rq, unsigned int flags) { - if (cpu_of(rq) == smp_processor_id()) + if (rq == this_rq()) cpufreq_update_util(rq, flags); } #else