Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5936981rdb; Thu, 14 Dec 2023 04:12:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFncjOjk2irwApfzyyjw/KZXXJAJ05/sLd8cQcv668NDbVRLk0AYn0eB0/3qN9MWpT9niAu X-Received: by 2002:a17:903:32c5:b0:1cf:c9c3:e79d with SMTP id i5-20020a17090332c500b001cfc9c3e79dmr5187525plr.59.1702555956700; Thu, 14 Dec 2023 04:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702555956; cv=none; d=google.com; s=arc-20160816; b=XJjQ5j7dbqrpW1bn9TXYjGLe+EeMzgGKy4S0ntSCZlsSgwjK339GRhOVO6vq9B0HFq UZvUq/Uvbzb/EGG/zU0MWP0qgi7rdiQ23UVcMeNLAMkysnQ3GzNuku8uNYzm1w97GlSM JcnX9t4EcdB4cN3+N8Mm+dCAUm2be2QcGrc3+4V85BzqkSO+aiv/eFF1BieO/DD1BAP0 PoAPBOPFWGUB5gKY8mYz1wAfbFsECWk6h2mhX7t7ql30fEcnV/E9uTCy9i/bCmROOrjB DPknPiZfS8hwBc8y1h6JX/25kfh+TMJHss4gT8doPGfnJtQucJO7/uwHma1XiydT1gM+ epBQ== 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:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=NR2YoO8t7v6bAvzxwQFbuBne8KZ84j3jDvGUNCqmPVA=; fh=wQjEwcy4BPrGaoeGr1LcEsFNv0p4Rt+c7QPDzzYWZnI=; b=USBXCJTB2U5rPgG30HBOs1UU4MzBCFyJS9UfyEH3mTwnltbkd6+jXV+EI8pQWZPxYU OvUI+4yGAAA9nKjzTvdblsh3mgAqJw1njeolIVALlzObqbOK4zmTur/5gVawCCC3JvPN cEKxVTjDfDgJoYARJWR7R/Tm38a21ipeGTE461BKdVv9jJSfv6xXhwqFtT+sMyEOSgPY zuhItF1loA0ImL/ix28a6RgFm+B5jy5/ddJQHl9EfDElw50N8kZAP4KUVPIAy/2nvTMO N2ulbyrSy5vnv6GddQnAkB3hBvfCY+a6TBs/OAcyOCmhSXqUmG3EqJif+HCKRFd8kW5v 5hxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="CAis/n42"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j5-20020a170902da8500b001cfb55da13bsi11305073plx.332.2023.12.14.04.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="CAis/n42"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A199A8275365; Thu, 14 Dec 2023 04:11:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1572967AbjLNMLL (ORCPT + 99 others); Thu, 14 Dec 2023 07:11:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572954AbjLNMLH (ORCPT ); Thu, 14 Dec 2023 07:11:07 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9310123 for ; Thu, 14 Dec 2023 04:11:11 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1d05199f34dso45871845ad.3 for ; Thu, 14 Dec 2023 04:11:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1702555871; x=1703160671; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NR2YoO8t7v6bAvzxwQFbuBne8KZ84j3jDvGUNCqmPVA=; b=CAis/n42W1TI56a5lSPLSZpRyPsdxh5Q+yJ1Tx3i+hPvt9rcwzadRe2ZGW+OuSh/Oa 3yyeeqN6U87+6UnaquPtJmbkLoN1yjs8POA3VZFevQjnjMLMTGJwym33YhR2TwS44iR2 jP4GwfFcxqRVuqhoa5Hecxz2z+3Rw200NPye1wq/Id59sXsTRtWa1V9X+PfRW6V9I2Wc RuBnID1UWrMd1SaAq6ZdiPx4tAmYS2TCHcIToPFF3MZTpXSWAs+1aSp/uVe7+jvVlzGC F058e7WiqtCGga6avdurqlICUU/qmgJ53uRGDvbsJOrJWUYacvVJtgfZZ4e4uANO0D20 N6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702555871; x=1703160671; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NR2YoO8t7v6bAvzxwQFbuBne8KZ84j3jDvGUNCqmPVA=; b=iunpW9I4hsJPZRd5LpW8mF187wFsJUH7fzmBkKlTrawpVfjIaIL8gxFMXJibMs4F/2 oFKFPhbIsfF5JNqnURrfW3LqVOJaO10dCZuMQ9mxzFRtRLlyooeZkCeMvmVcrHNExqFP Prso7s3k5BpHMFAt6JDUdsnFGMrzveUNp5I3J+hAV97mYspR+HGs/glmcxEe6SKXmXUf dbiEMgQKU/DIrvuk1y8KmJhU41E0Q/jPxN9QYOwkA33M9ACQXd34YKY79zhgWzSweAw5 iNBHfnQxTApWFjsFz95ljYghAEZH3L5Z612RNaws/EflSvGN0r4cTyV1MhtWGauiactP ZG7Q== X-Gm-Message-State: AOJu0YxEw027fnNW5UxVJB5pxr9Nag/RAk0Kn0ooLTLyRhzBHXmf3lPj 04f4/f/C6so9dRmMnnSLKjwVzw== X-Received: by 2002:a17:902:fc46:b0:1d0:897e:95e5 with SMTP id me6-20020a170902fc4600b001d0897e95e5mr7044851plb.35.1702555871404; Thu, 14 Dec 2023 04:11:11 -0800 (PST) Received: from [10.254.92.96] ([139.177.225.240]) by smtp.gmail.com with ESMTPSA id v5-20020a1709029a0500b001d0d312bc2asm3051978plp.193.2023.12.14.04.11.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Dec 2023 04:11:10 -0800 (PST) Message-ID: <6c89812d-a7ef-42df-9ca7-22092937f13c@bytedance.com> Date: Thu, 14 Dec 2023 20:10:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Re: [PATCH] sched/fair: merge same code in enqueue_task_fair Content-Language: en-US To: Wang Jinchao , Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, stone.xulei@xfusion.com References: <202312101719+0800-wangjinchao@xfusion.com> From: Abel Wu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 04:11:54 -0800 (PST) On 12/14/23 5:47 PM, Wang Jinchao Wrote: > On Wed, Dec 13, 2023 at 09:23:46AM +0100, Vincent Guittot wrote: >> On Wed, 13 Dec 2023 at 08:04, Wang Jinchao wrote: >>> >>> On Mon, Dec 11, 2023 at 04:23:52PM +0100, Vincent Guittot wrote: >>>> On Sun, 10 Dec 2023 at 10:22, WangJinchao wrote: >>>>> >>>>> 1. The code below is duplicated in two for loops and need to be >>>>> consolidated >>>>> 2. Fix the bug where a se's on_rq is true but its parent is not >>>> >>>> Could you clarify which bug you want to fix ? >>> Taking into account the additional information provided by Tim, >>> this is not a bug. Therefore, this patch is merely a logical >>> simplification. >> >> If there is no bug why changing it ? > For two reasons: > 1. (from Abel Wu) > It doesn't need to, but it can actually bring some benefit from > the point of view of text size, especially in warehouse-scale > computers where icache is extremely contended. > > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-56 (-56) > Function old new delta > enqueue_task_fair 936 880 -56 > Total: Before=64899, After=64843, chg -0.09% But TBH this benefit is kind of weak to argue about, given that you don't have any data supporting it. > > 2. For better code comprehension > I became curious when I reached this part, wondering why there is a lot of > repetition inside these two for-loops. Then I thought about 'do not repeat yourself,' > and I feel that merging them would lead to a clearer understanding. Of course, > it might be because I am just starting to read scheduler-related code and am not > yet familiar with the entire logic. >> >> The duplication is done in order to have the same pattern in : >> enqueue_task_fair >> dequeue_task_fair >> throttle_cfs_rq >> unthrottle_cfs_rq > Due to the two points mentioned above, do we need to adjust all four functions? >> >> so there is no need to change it > I plan to get familiar with the scheduler-related code first and then consider this. > > Thanks >>