Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp76508rwe; Fri, 26 Aug 2022 00:36:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4/Ufyc0GLX/fWiUvv3fMI9ipOj0RbHRIZTQX2+1GPLmuv4fqdQQfgFv4lQItdzjRthgAQQ X-Received: by 2002:a17:902:ebc8:b0:172:549d:e392 with SMTP id p8-20020a170902ebc800b00172549de392mr2537456plg.141.1661499401280; Fri, 26 Aug 2022 00:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661499401; cv=none; d=google.com; s=arc-20160816; b=R12XMiu7hStxWRmELgi+GCo7u2cwGzclM8twD7FgY95GDr4DWgZ18Mv/nlQ+H2D4wx 56hIfaMCrLpNkMW2iLzqrIqofhxGnuCBwll2ljiXzh2AjdJ1XMsMk+SHJ5tHVjCJCKqR lvDipgASII97BFk7rYIAk+274yZW3VteUqcOMUAvHJIy1V34Qsbri36PZQi2oGuBJAxw ZZ9/GcFZKCslFZu4WYMoCB/M9E+x4KXAyn0KKXbneZrCtxKim4qyZK6RSSjmklMQliK2 p2YhnWLZVLRx2TL8DQCl0pKknUM0jBwoT6U/Co9AQU05H3AQWNb7jAO9L7H9CUKoKoJp g6Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=VBCGXBGnNQIzeNHxCxgi5TIrjPPuWwmYyMxc+Xrk2nc=; b=gUM+EMsT+s6FKpbXxaMSkH1fQyt+Vet0vTtz/Urb9CJkw+aWWzMki6TepJBCs49l4U glDeKDpAd37IQEeIzpVDULQ5Q0Ap56wGFNT/AKlcg8nmvgV8AGbPofMQMjurO1DzqNPq c44DeFbaITS+HH6XFiARd1BGRjVu/uV+DevprWPdjdcR+606ESytIiaJr1obLL5USq6L UHswJjEU0Djn/S1ExBPuxkYUAhZ5DL3BUYBm0fLNhiXvxzWr4LTw/6qv4y8t3GG2biBI QuWcrPItlVL4knElFMSfwn8EY6sVtvV2GMWlBIWT+mUobAiP3idSIAH8q+ALtQIvKJZ+ Hd5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a6383c6000000b0041cea4daf7dsi1096997pge.774.2022.08.26.00.36.29; Fri, 26 Aug 2022 00:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245242AbiHZHYA (ORCPT + 99 others); Fri, 26 Aug 2022 03:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245250AbiHZHX6 (ORCPT ); Fri, 26 Aug 2022 03:23:58 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02BF2D31D9 for ; Fri, 26 Aug 2022 00:23:56 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MDWVr63VqzGpq2; Fri, 26 Aug 2022 15:22:12 +0800 (CST) Received: from kwepemm600008.china.huawei.com (7.193.23.88) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 15:23:54 +0800 Received: from [10.174.176.230] (10.174.176.230) by kwepemm600008.china.huawei.com (7.193.23.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 15:23:53 +0800 Message-ID: <93f6bfae-7c2c-69e5-720c-89ba63e3a3fe@huawei.com> Date: Fri, 26 Aug 2022 15:23:52 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 Subject: Re: [PATCH -next] sched/deadline: Add compare_task_rq helper To: Daniel Bristot de Oliveira CC: , , , , , , , , , References: <20220826031143.9501-1-shangxiaojing@huawei.com> From: shangxiaojing In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.230] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600008.china.huawei.com (7.193.23.88) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/8/26 15:10, Daniel Bristot de Oliveira wrote: > On 8/26/22 05:11, Shang XiaoJing wrote: >> Wrap repeated code in helper function compare_task_rq, which return true >> if there is no deadline task on the rq at all, or task's deadline >> earlier than the rq. >> >> Signed-off-by: Shang XiaoJing >> --- >> kernel/sched/deadline.c | 23 +++++++++++------------ >> 1 file changed, 11 insertions(+), 12 deletions(-) >> >> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c >> index d116d2b9d2f9..4a40a462717c 100644 >> --- a/kernel/sched/deadline.c >> +++ b/kernel/sched/deadline.c >> @@ -1810,6 +1810,13 @@ static void yield_task_dl(struct rq *rq) >> >> #ifdef CONFIG_SMP > I see the value of this helper, but "compare_task_rq" is making things more confuse. > > Choose a more descriptive name, like, dl_task_is_earliest_deadline() ? ok, i'll find a better name, or take your advice directly in v2. >> +static inline bool compare_task_rq(struct task_struct *p, struct rq *rq) >> +{ >> + return (!rq->dl.dl_nr_running || >> + dl_time_before(p->dl.deadline, >> + rq->dl.earliest_dl.curr)); >> +} >> + > -- Daniel Thanks :-) , Shang XiaoJing