Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3178349imw; Mon, 18 Jul 2022 03:36:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLTeMfK+ti2YdyedSZHGuoeE4rqmNHznPdIg+wxP9fX5XNM0wIUiznakkd65bbFePhF0iA X-Received: by 2002:a05:6870:ea90:b0:101:fb35:883d with SMTP id s16-20020a056870ea9000b00101fb35883dmr14437669oap.23.1658140598887; Mon, 18 Jul 2022 03:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658140598; cv=none; d=google.com; s=arc-20160816; b=gpvwZnWYcSxq6A/xU6iyHa11AtCIm9gEDgTg8iiFvXmAXQrOXYUJu9PcFrKm+HEXYr mffp5qfCUlROVoHHWPPaYl0n074fy9oshZbUaASYSoKrcG0miVbY1tO39zGsc8Gaa8YK myMtPhWFvbWmz3gh/z+AR0AY3M+ekTaSR3TcixDXLrUAtIutn4EJYD4FJEELWpQXZB0O JCRqjOebLDCzLiLrxYzIdW269NANJpdSgp4ZR1USTm1glrP/QDQOIhWvX88DUxGCvIwB Nl9jWeGeoESR5owah/GzjNQqIW/4xwivNR7i37y4vMgn0ckllniatH+44+pnhbAh7z2x eKZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HS2UsDmlONN/TsrEqFJ0NU5Aa0VHYd5/NZKmxyuPu4Q=; b=IdaVg5RwA108W0pKx8JqVsqOzpysHEwkWSaBpoURABDIZuLhMa20en+MqLTamtmpXj UrymbUKAhhcgNQBNHb+8qP05RL0IEy+Hr0j/jl1XFhoBRiMGpOGhhwp5DASU31kvmGbs 3fMsQm5kU3n7y+MmbcWL1qcae6SGPzJbzRSyBQXvGRb6MB2m/SnwgL3HTtgDu8McorWR 435IEb5jjU1EOIHdCm/hCVtZcsXsspdO6IrgkM2nutyk+jq9RkyTeHUZQx3ju+BmxQ9x eDrkW4HTQXfCZHaap7alErpUGy9dQcFljZ4Vp+mY8tCeLt033hL2nnsDI/c5NTCig46Q A+8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e0urG4Lh; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a056870d68800b000f2b788feb1si10605974oap.229.2022.07.18.03.36.24; Mon, 18 Jul 2022 03:36:38 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=e0urG4Lh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233865AbiGRKKm (ORCPT + 99 others); Mon, 18 Jul 2022 06:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbiGRKKk (ORCPT ); Mon, 18 Jul 2022 06:10:40 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B87DFFC for ; Mon, 18 Jul 2022 03:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HS2UsDmlONN/TsrEqFJ0NU5Aa0VHYd5/NZKmxyuPu4Q=; b=e0urG4LhcVnmsvCrFe1jGd73JY aEWzRcnvjrs3JJVjjoktTS07Ua/fBwzuongfh47cpS/ManFnXAXW92MUHB6wVNH8Am0ciJKHRpP+3 VnB0bHaw3IHFKDW1z24YA6tlEgtK5zZAbmULAJTIFaIDMfwy1HCbLQnvg1A1WW1QfaPMMUrPZUB6G GLP41t3qp5h8xGNQ9kzvg7urnAW/m9yMrHisAtCx68HNwZ0rZgvAXLOWvJVwgxgnSMUdX0VEv7cdv gAkuSOJ/8g3Bmo3tm/k+37uCSdbVCGJnzx3GZitsHPS7mlXS06x3Prdlmbghu/qxi2pVtJ4jSU1H+ pVtXGotQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDNhu-00CauV-Oq; Mon, 18 Jul 2022 10:10:30 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 87BE5980226; Mon, 18 Jul 2022 12:10:29 +0200 (CEST) Date: Mon, 18 Jul 2022 12:10:29 +0200 From: Peter Zijlstra To: Peng Zhang Cc: mingo@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/fair: optimize entity_tick() Message-ID: References: <20220718094937.37360-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220718094937.37360-1-zhangpeng.00@bytedance.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Mon, Jul 18, 2022 at 05:49:37PM +0800, Peng Zhang wrote: > From: "zhangpeng.00" > > entity_tick() will be called to check preemption by calculating each > sched_entity's time_slice in a task group tree from bottom to top. > > If a need_resched_flag is set by a checking of a sched_entity, > there is no necessary to check preemption of the sched_entity's > parent and ancestor entity. > > So we can test if the need_resched_flag has been set before calling > check_preempt_tick() to avoid unnecessary calculations. > > Signed-off-by: zhangpeng.00 Optimization patches should come with numbers showing they're worth it. Also; did you consider side-effects from check_preempt_tick(), like clearing buddy state etc.. ?