Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5707981pxu; Wed, 23 Dec 2020 03:32:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKEyznmUZNpjY5Qnf4OOpoIOmRQFBkb+dTkcf1B858uMWQDCvHjpi4HIGWR2fDOvbxcfIV X-Received: by 2002:a17:906:b1c8:: with SMTP id bv8mr24092537ejb.208.1608723136589; Wed, 23 Dec 2020 03:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608723136; cv=none; d=google.com; s=arc-20160816; b=BNyRQzshWVUl0jGhasIRmQc9KjAyoSPbYC+BiAjVeoeofImLsYTvi0aTHw9puhRHVf AJmPsEMliTZEuzw9r5Vqa4GQBoGmJsbSC+nbIDDgHIFwnPXx0KE8JHoY7HWPEwjZ80f5 Lsm4SqkXUW9fKhiTxhVrdwUyCVeH5m+ltxHMa99Pay6+SG2XKHlye1anBd83TVBRU5Dk R3bvABs01CzGwvQuPgTDGE/uVvjVhuU8tzDwLE0LKPn/Qd9bPZHLHdWmomNgyrY6je6O d8vG+V/CzqGhw3PVyihA9CaXCF0xVX4BVe7jiN/kr+AdB4pgIR2YoGVB61sn43OKsX+Y twuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GBYdNW8Z4yi2ObUNArjSPg/6GZRX3BMgxb5wuc/+8YM=; b=RPI54I8+bS0ExdTj4wvLc7SsGRc2k5WS0VNId7KbIL340gUMAgHA1JOWS2HWj2i5Jj ZpoDTCX5pGlXRU5Sin38MYrEtX6Fk3zWAlt6qxek1kFm9tp8RG0ExI9LRdiBkvEZIAdO iYnAzmjZyk0W0u7JbmYXCSgyzgu5/yCt3Tc5luoklVuOvaOzNJBIN3IjtFB/u6tddB94 CeWP87YhIh9LFHdAJWhniWb9aSjtdawotkFfX4+Qle0bsanNKlekxJuY61Iz7QL/faH5 FDHPwm1EMOcNPx6ROYZ5kfJx4N7XA+/AIzLVnFsI1mAsXZdik1CHWGz0ow96F0lUdj7H nQ+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=udMKnRNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i8si13669395edr.271.2020.12.23.03.31.54; Wed, 23 Dec 2020 03:32:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=udMKnRNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728633AbgLWLbU (ORCPT + 99 others); Wed, 23 Dec 2020 06:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728436AbgLWLbT (ORCPT ); Wed, 23 Dec 2020 06:31:19 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F94C0613D3 for ; Wed, 23 Dec 2020 03:30:39 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id o19so39414125lfo.1 for ; Wed, 23 Dec 2020 03:30:39 -0800 (PST) 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=GBYdNW8Z4yi2ObUNArjSPg/6GZRX3BMgxb5wuc/+8YM=; b=udMKnRNSqCZ9VaPT8w+/uer0wFXYURGMXvgy4gF9jZieziZKK3X5ND3buV+GyBOrOV QmmNC3oQ59pRtzcWqu3UeNlesSzA3N5XEAmhZmyczK8cPmWO1sgQbvCDDp7tLecIHGYr 7vbgnA7H6qqSnxCeaM64wjPHlCoF9QYQzFPCUiWQmZFlJr/KgqZe1sLz/f6c1ZWvEJ+n 8gIlsOuP+EiWYt3X9KcmuAxdZ4fkigaEgnKifRhJw/8UAq9dSak+3E/1cV5eHmNT8Y62 7gjjjFRLuv5cVTBfMbkhAsognqFhL6tlhnC+/uf8MhL39tEbPcQZb8pQz/OnCKnmSDN0 CHQg== 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=GBYdNW8Z4yi2ObUNArjSPg/6GZRX3BMgxb5wuc/+8YM=; b=AgJ+lB9eiWgFU+AglMiVDCkXwA/dK++dUQn8EyJclmzebQqBGJkVB/FISB1vLpNveG gAiXLgd6uu24nHV3qk/a57hCkF+7iDrpQuZGg+R/G2zSRJC/CHOUGZewgNY58vMKL6qG AGWZwGMgto/HhH40JxlIRQDsRb02yDrZu6W+vqU3VgClJqJIDSlYqpm2QAqpG2AQmxNK fKjz+wafSN6eAOeG8B9udMga3hUMcdBwhNcOf9WVFgFJDnezwLwaYHCB1EdDclFdtBRX JFW+6rYPWoMWGv7oWL1dPXSQgS1jqZ90kkfBKxXL7AvwsxsD/ADrMOoqmmQY7KN+pSHi YmXQ== X-Gm-Message-State: AOAM5327n8zMfPnfEGkv6QkJLCbws7mYJXHxvt5OAzfQ+o4MLz0ukwac 9VWBn8grSglPM2Dl/LWkWKdf3+JbRMXZ1bWHJoNaURF0oVoSzQ== X-Received: by 2002:a19:7718:: with SMTP id s24mr11290716lfc.277.1608723037614; Wed, 23 Dec 2020 03:30:37 -0800 (PST) MIME-Version: 1.0 References: <1608710968-31475-1-git-send-email-ultrachin@163.com> In-Reply-To: <1608710968-31475-1-git-send-email-ultrachin@163.com> From: Vincent Guittot Date: Wed, 23 Dec 2020 12:30:26 +0100 Message-ID: Subject: Re: [PATCH] sched: pull tasks when CPU is about to run SCHED_IDLE tasks To: ultrachin@163.com Cc: linux-kernel , Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , heddchen@tencent.com, =?UTF-8?B?eGlhb2dnY2hlbijpmYjlsI/lhYkp?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Dec 2020 at 09:32, wrote: > > From: Chen Xiaoguang > > Before a CPU switches from running SCHED_NORMAL task to > SCHED_IDLE task, trying to pull SCHED_NORMAL tasks from other Could you explain more in detail why you only care about this use case in particular and not the general case? > CPU by doing load_balance first. > > Signed-off-by: Chen Xiaoguang > Signed-off-by: Chen He > --- > kernel/sched/fair.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index ae7ceba..0a26132 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -7004,6 +7004,11 @@ struct task_struct * > struct task_struct *p; > int new_tasks; > > + if (prev && > + fair_policy(prev->policy) && Why do you need a prev and fair task ? You seem to target the special case of pick_next_task but in this case why not only testing rf!=null to make sure to not return immediately after jumping to the idle label? Also why not doing that for default case too ? i.e. balance_fair() ? > + sched_idle_cpu(rq->cpu)) > + goto idle; > + > again: > if (!sched_fair_runnable(rq)) > goto idle; > -- > 1.8.3.1 > >