Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp755638pxu; Thu, 26 Nov 2020 10:56:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJymyOPqblFCgQy1vhNN+9+kyYWmDpMpCs98Vt7Doo3DD/5hXOv7tgcev3hci0Z8M8qmat+e X-Received: by 2002:a17:906:1317:: with SMTP id w23mr4004541ejb.120.1606417008629; Thu, 26 Nov 2020 10:56:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606417008; cv=none; d=google.com; s=arc-20160816; b=HAwgBVx0j1kTHqYLYd5vzdYhVCGsjZLR9uLo7y1hC7m/7/KY1F8mf14S2t56G0L0j8 hww6jFFcRToSGyYs+5iG/19i9rXm1CeJ9qhL4HopAWWaRQ+Y97y4hbVejHDQG2RxAggF ptgX2Kfwgd+3XXD8onoIAt8/9bDQZXVVz2xtsZLwZj7KZqR2kVlDrI1xfKaj6tMYeUlj d3qmmPRwgHt1X7OptBlSKi6bmvvxgyYc7Pe8cewbQFK/TBu4uRoec13I5OARFLeSSZAj bao/peMRAEb63ciNSuPQOUNe9QkSH9T9yBdYDDc2fy/nOADHNaDY3NMaoZQS1m1NXWd6 E4gw== 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=afKXxLX/izYfyyB9oQMohUAdu4xtjRHSqiKSx+Whd3Q=; b=ANg3t6Yzoex7xDjNKVVShKACrgceF0hbtWEwkCwz5ywrTLKNmt/Nmp5iU1adm/93YS /Clbja2iUp0FBZ1D5k6fRrNi5FWhIBCa4B2EKQAACGgfn8FNI/Xx5FC3w0f7/Ug1wwty XQuseLtqbJbvLpOTVw1z5KJ8MKdt4a9boIMOqDK2fpKiPVGWxkmSX/ULCZG0OYE/W8lv MopkCzlJN5bWF0PM4b9CLyQh1jOJlNIW9MUvquBKSb5wT0gHQtsmh/Vyjb3u823jAoQ7 G7pwX9+UFHxhPv5TbOwlczXxLNR5ISox3hRe/FEYMLQ1U0CIGCpcWL+8FmG0IEXbGkLO aU1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r4plu1fq; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si3809395edr.593.2020.11.26.10.56.22; Thu, 26 Nov 2020 10:56:48 -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=@gmail.com header.s=20161025 header.b=r4plu1fq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbgKYXTp (ORCPT + 99 others); Wed, 25 Nov 2020 18:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729156AbgKYXTo (ORCPT ); Wed, 25 Nov 2020 18:19:44 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4D39C0613D4 for ; Wed, 25 Nov 2020 15:19:44 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id w187so3797047pfd.5 for ; Wed, 25 Nov 2020 15:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=afKXxLX/izYfyyB9oQMohUAdu4xtjRHSqiKSx+Whd3Q=; b=r4plu1fqB3knZg9ornwiE4Knf97ou/qnfHjO6/05pGxqmtwIYcXB8Qu9ztRU9EGYV2 SZI2Y4TjE3UcSNNxuDqZsNlldotTpN2LHo/WgN4SaIy84t7O81hrtQi55qno1jscyYeA 6YYWRc70YnRBCCOdTX51I8TCCl4pcEV8fmjH5ODGfg7p6pz+Imgid/jsuUQg8AvRkWIf 5QA6spszM/m6PE/aOE5edZ3kdYmGoCc0nudVFBjJoeK9c3nY4wps5bIjTAq1zuhx3Vic Iw41HH0mbmSGOY5GLbKOaukhiurWcaz7gNWd9vGF7JtXXPqR96Bo0ocsVkDVHBfbAECU 47Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=afKXxLX/izYfyyB9oQMohUAdu4xtjRHSqiKSx+Whd3Q=; b=tpaXx/pOcHDWk3HL79LI3pneFp5aYmG1l7RSH9oWXGX5Y+r+2Nue9WWZ/U74R8Mm86 ft8EmeNpfCSeE2wPCF4w2BRlzkeQTixEqO6A4WBuxGHku52TKOyvFnCDQm3LA461CrU3 X+cFrFWojHYwZYcT+ek1VmYNqZKB1x6mkP1Go251Rnmar4AsIX+BEVIzLIhrCzJUSPM+ u39UGsAaSiqLwv+kGd0K/IX246YyypBzvimzOxY6wlwJqwPYlghTXxlHioXzKCDOlEhp Rjl4h8tziEMfErzmVaI69c9e9Gvhe/n2XRbhrtwEmq1+nRKbjVm9/Z2bboj0V4Rlea7O xohA== X-Gm-Message-State: AOAM533q+eRz7u4VnH6KISWrptR9Vh8tU7s+kK9B3TR3m1CmNebifPwi CDjtn37O0F5wojagEfShVYI= X-Received: by 2002:a62:c1c1:0:b029:198:14d8:6e98 with SMTP id i184-20020a62c1c10000b029019814d86e98mr263952pfg.10.1606346384152; Wed, 25 Nov 2020 15:19:44 -0800 (PST) Received: from localhost (61-68-227-232.tpgi.com.au. [61.68.227.232]) by smtp.gmail.com with ESMTPSA id j19sm2773164pff.74.2020.11.25.15.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 15:19:41 -0800 (PST) Date: Thu, 26 Nov 2020 10:19:38 +1100 From: Balbir Singh To: Joel Fernandes Cc: Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, pjt@google.com, rostedt@goodmis.org, derkling@google.com, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , Junaid Shahid , jsbarnes@google.com, chris.hyser@oracle.com, Ben Segall , Josh Don , Hao Luo , Tom Lendacky , Aubrey Li , "Paul E. McKenney" , Tim Chen Subject: Re: [PATCH -tip 02/32] sched: Introduce sched_class::pick_task() Message-ID: <20201125231938.GE163610@balbir-desktop> References: <20201117232003.3580179-1-joel@joelfernandes.org> <20201117232003.3580179-3-joel@joelfernandes.org> <025bb649-89c5-a353-1434-2da725adffd9@gmail.com> <20201120165854.GB1021337@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120165854.GB1021337@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 11:58:54AM -0500, Joel Fernandes wrote: > On Fri, Nov 20, 2020 at 10:56:09AM +1100, Singh, Balbir wrote: > [..] > > > +#ifdef CONFIG_SMP > > > +static struct task_struct *pick_task_fair(struct rq *rq) > > > +{ > > > + struct cfs_rq *cfs_rq = &rq->cfs; > > > + struct sched_entity *se; > > > + > > > + if (!cfs_rq->nr_running) > > > + return NULL; > > > + > > > + do { > > > + struct sched_entity *curr = cfs_rq->curr; > > > + > > > + se = pick_next_entity(cfs_rq, NULL); > > > + > > > + if (curr) { > > > + if (se && curr->on_rq) > > > + update_curr(cfs_rq); > > > + > > > + if (!se || entity_before(curr, se)) > > > + se = curr; > > > + } > > > > Do we want to optimize this a bit > > > > if (curr) { > > if (!se || entity_before(curr, se)) > > se = curr; > > > > if ((se != curr) && curr->on_rq) > > update_curr(cfs_rq); > > > > } > > Do you see a difference in codegen? What's the optimization? > > Also in later patches this code changes, so it should not matter: > See: 3e0838fa3c51 ("sched/fair: Fix pick_task_fair crashes due to empty rbtree") > I did see the next patch, but the idea is that we don't need to update_curr() if the picked sched entity is the same as current (se == curr). What are the side-effects of not updating curr when se == curr? Balbir