From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8170EC4332F for ; Tue, 7 Nov 2023 10:42:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233963AbjKGKmz (ORCPT ); Tue, 7 Nov 2023 05:42:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbjKGKmx (ORCPT ); Tue, 7 Nov 2023 05:42:53 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B1BA3 for ; Tue, 7 Nov 2023 02:42:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=VUPXmPqoD7zPq0gyHwJF1zhaeV4JZiznxUuuQGFLTF8=; b=Z3TsQ1y3zLXhKrXlNO8ZJ357kN pHUq+Vbfo12EfTkZuiBl41s657o9F4AFHrdbnGcPgjGTs20KrNvw9ekzbDm331iiJJSrF+0oIfDBH QytD7hDKbXHKvvPr12oV4cSysft1jCQdYFFuSfk2RRYfCmM0zgiqOiUTOlJZpEMXyrww1mb7shIpr F5pqfC86L6ZS6RezRrjmu/26CQveG5OfC0tFr3jQrJRZAP/jutXlFxUcW7HwvVwA8VEOafTRbk7TF pIE8aJvWB0TlCuDqMobYXr502kNB+wObx11vYiyngR9OF9XOuDIVFvKYjxjhdevUAtgymmXfH4hEg 5C32V5HQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1r0JX5-00Bvql-1d; Tue, 07 Nov 2023 10:42:07 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2DCDA30049D; Tue, 7 Nov 2023 11:42:07 +0100 (CET) Date: Tue, 7 Nov 2023 11:42:07 +0100 From: Peter Zijlstra To: Abel Wu Cc: Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Barry Song <21cnbao@gmail.com>, Benjamin Segall , Chen Yu , Daniel Jordan , "Gautham R . Shenoy" , Joel Fernandes , K Prateek Nayak , Mike Galbraith , Qais Yousef , Tim Chen , Yicong Yang , Youssef Esmat , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] sched/eevdf: O(1) fastpath for task selection Message-ID: <20231107104207.GT8262@noisy.programming.kicks-ass.net> References: <20231107090510.71322-1-wuyun.abel@bytedance.com> <20231107090510.71322-4-wuyun.abel@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 07, 2023 at 06:12:49PM +0800, Abel Wu wrote: > > @@ -904,7 +905,7 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) > > * in this cfs_rq, saving some cycles. > > */ > > if (cfs_rq->nr_running == 1) > > - return curr && curr->on_rq ? curr : __node_2_se(node); > > + return curr && curr->on_rq ? curr : se; > > Maybe we can reduce memory footprint on curr by: > > return se ? se : curr; Irrespective, I think that logic makes more sense. If we know we have but one task and the tree has a task, it must be that task, otherwise, current must be it. Anyway, I was still staring at the previous patch, flipping the tree around like that is clever. Yes I suppose that ought to work just fine.