Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8047768ybn; Tue, 1 Oct 2019 02:18:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBOt80XP0kRSeeAqFSVmjG/wUG1lsRq2K4phX5Sy2aQvg9cePF+8bMwIo1Fh3+YIPW4Vhe X-Received: by 2002:a17:906:7802:: with SMTP id u2mr13974176ejm.3.1569921495018; Tue, 01 Oct 2019 02:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569921495; cv=none; d=google.com; s=arc-20160816; b=xpNs9HCMeAkOxccIv0BHVu1p7xihgMr0NnK+uvTP4oIge0c1p2nFmq30c5mrT+ULcn sOMo9edQZBDH+W1LBVeWqY/IVakPSoUQSRVQI3ZyO0om0xmGes2b/SjLCbCTtVmCmucd 2AEudLCxSbRC6+R2ErixB2aTsOgR3AFwmu5ovWMA0fF8KbHNm7H/IMcoqAJKTGJ9rYex UAc4V0W4qq/g4pd+vgjaVJglVslRjJvvscsyoYpghuyHrCMwqCjlsA2svOKrUS0gCFwC AskCizF+hsowf6L7OsKClbCjhjg+Z/5KbCFYHUlgtEGrimEVxeeluKJTqYQMw8cxCO5J vPow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lpGVuUxSxKMiuwRTwy01a7scEo77bnYExxr3k+l2+X0=; b=zAqITBvZDHb0agxsaMoaK4q9CgcJDgsdiPchq62qtdhSDD2dWZcw3IjDEyEa99Wqqr dnoONTe3se8sdRP4yIRZ7vvXwGGC9BaKBnwlnzoPZ1My4HAgbKvFuNZ6HMKmrFpqiRBA gvylh5nwkY3LIhIWY1wqWdY71jaUwYal7e/r7iwWSX3Xnq3jn9ZKZYMP6yvKJSZK7Ezi LFiF6A2E4D9D/oBAdQ5rqdi4kMsEWkMdVCYLey3lPxq8onWN3okgGTRpJq8OptYn4dlu s4ea78uTJbJX09HfmbiAapc2IY6wmRlZIBVAUWAIbuQktkN6/rhfib7B07pqFj79aFip dPDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tf2QY8xO; 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 l18si8334161ejg.248.2019.10.01.02.17.50; Tue, 01 Oct 2019 02:18:14 -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 header.s=google header.b=Tf2QY8xO; 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 S2387460AbfJAJOr (ORCPT + 99 others); Tue, 1 Oct 2019 05:14:47 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:32946 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728748AbfJAJOr (ORCPT ); Tue, 1 Oct 2019 05:14:47 -0400 Received: by mail-lj1-f194.google.com with SMTP id a22so12546532ljd.0 for ; Tue, 01 Oct 2019 02:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lpGVuUxSxKMiuwRTwy01a7scEo77bnYExxr3k+l2+X0=; b=Tf2QY8xOlAdj1IcCPnKHYar5usIdaAw0zLTtghp0Qtj2p4F/aIxi0RHLQ2AOGpQ9T0 m5pIvx5Zo6FQ4K1oKtf1fCBE3I/VcyFjFV6czrrd48ER0PgKV3yESJ3k5oWD5AxpbNIp 09po/kHeK47eNvqdkTrKmweqwsai6sM5POg4p2S0XFEITB+SjOlRzaO5I5Zxhhrc/ZWg fp/evDg0J7fEgR4Kj52tGnEv/4+NDlAeu3k1G5qmVOcOMSZv6PWErgJN6eoyt5XB8u6k fvdlUNOrHSOSk6VTLSSg4F8Eia9Qg/9a9WPpUjUnRvKMnUUfmWQbhzgbXhK1I/0n2NtT jsMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lpGVuUxSxKMiuwRTwy01a7scEo77bnYExxr3k+l2+X0=; b=a+Dp32mnycp88ZJUNvsUvXeKR6q6IBwgExODDGrmcn8vqg8wc/xuxOzGQCgK1mA/T2 jKZylVlxtY/QYQzZqk6tmyJzA4bZCWIsNHS9LFTcPJk1RQb+g5hxv10JxayvTaOKZ2oW wK/lMZq/0BKmsQitBmJRg/Slnv+aTYFzKN0Xb3w9wZ8jCqWrk/Vo6pd9Dq+wIqLEWfey Zl8kddbqvOusxcdf18uTmJ2w8KfMZwtszwvXsGoQ31FHxQBj+XRBDqMRJEBNZVt8Fkyh 1sTjngDu0NbfzXc0RhM4jwEclw4sdJ9E7XKUF5TcpyIaNi2hGnxuQfyPnvrZl+xid+Ru pmWg== X-Gm-Message-State: APjAAAW1xg0I+s2ijr3Tva8eWSK4yzDtjblXJupkTCbiQN3kORIc7UBf 1VzsWh26mDTxadG3cpXexH1jvhOH9Jmng9tdTQfYoQ== X-Received: by 2002:a2e:42c9:: with SMTP id h70mr14817238ljf.88.1569921284671; Tue, 01 Oct 2019 02:14:44 -0700 (PDT) MIME-Version: 1.0 References: <1568878421-12301-1-git-send-email-vincent.guittot@linaro.org> <1568878421-12301-5-git-send-email-vincent.guittot@linaro.org> <46e81a81-f88e-c935-d452-9b746bde492b@arm.com> In-Reply-To: <46e81a81-f88e-c935-d452-9b746bde492b@arm.com> From: Vincent Guittot Date: Tue, 1 Oct 2019 11:14:32 +0200 Message-ID: Subject: Re: [PATCH v3 04/10] sched/fair: rework load_balance To: Dietmar Eggemann Cc: linux-kernel , Ingo Molnar , Peter Zijlstra , Phil Auld , Valentin Schneider , Srikar Dronamraju , Quentin Perret , Morten Rasmussen , Hillf Danton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org group_asym_packing On Tue, 1 Oct 2019 at 10:15, Dietmar Eggemann wrote: > > On 19/09/2019 09:33, Vincent Guittot wrote: > > > [...] > > > @@ -8042,14 +8104,24 @@ static inline void update_sg_lb_stats(struct lb_env *env, > > } > > } > > > > - /* Adjust by relative CPU capacity of the group */ > > + /* Check if dst cpu is idle and preferred to this group */ > > + if (env->sd->flags & SD_ASYM_PACKING && > > + env->idle != CPU_NOT_IDLE && > > + sgs->sum_h_nr_running && > > + sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) { > > + sgs->group_asym_packing = 1; > > + } > > + > > Since asym_packing check is done per-sg rather per-CPU (like misfit_task), can you > not check for asym_packing in group_classify() directly (like for overloaded) and > so get rid of struct sg_lb_stats::group_asym_packing? asym_packing uses a lot of fields of env to set group_asym_packing but env is not statistics and i'd like to remove env from group_classify() argument so it will use only statistics. At now, env is an arg of group_classify only for imbalance_pct field and I have replaced env by imabalnce_pct in a patch that is under preparation. With this change, I can use group_classify outside load_balance() > > Something like (only compile tested). > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index d0c3aa1dc290..b2848d6f8a2a 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -7692,7 +7692,6 @@ struct sg_lb_stats { > unsigned int idle_cpus; > unsigned int group_weight; > enum group_type group_type; > - unsigned int group_asym_packing; /* Tasks should be moved to preferred CPU */ > unsigned long group_misfit_task_load; /* A CPU has a task too big for its capacity */ > #ifdef CONFIG_NUMA_BALANCING > unsigned int nr_numa_running; > @@ -7952,6 +7951,20 @@ group_is_overloaded(struct lb_env *env, struct sg_lb_stats *sgs) > return false; > } > > +static inline bool > +group_has_asym_packing(struct lb_env *env, struct sched_group *sg, > + struct sg_lb_stats *sgs) > +{ > + if (env->sd->flags & SD_ASYM_PACKING && > + env->idle != CPU_NOT_IDLE && > + sgs->sum_h_nr_running && > + sched_asym_prefer(env->dst_cpu, sg->asym_prefer_cpu)) { > + return true; > + } > + > + return false; > +} > + > /* > * group_smaller_min_cpu_capacity: Returns true if sched_group sg has smaller > * per-CPU capacity than sched_group ref. > @@ -7983,7 +7996,7 @@ group_type group_classify(struct lb_env *env, > if (sg_imbalanced(group)) > return group_imbalanced; > > - if (sgs->group_asym_packing) > + if (group_has_asym_packing(env, group, sgs)) > return group_asym_packing; > > if (sgs->group_misfit_task_load) > @@ -8076,14 +8089,6 @@ static inline void update_sg_lb_stats(struct lb_env *env, > } > } > > - /* Check if dst cpu is idle and preferred to this group */ > - if (env->sd->flags & SD_ASYM_PACKING && > - env->idle != CPU_NOT_IDLE && > - sgs->sum_h_nr_running && > - sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) { > - sgs->group_asym_packing = 1; > - } > - > sgs->group_capacity = group->sgc->capacity; > > [...]