Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2990666ybl; Fri, 20 Dec 2019 02:02:39 -0800 (PST) X-Google-Smtp-Source: APXvYqxxgKhmoqgO6u68zf7bmyB+T08LWuz3q7nfHHlagRA/HPTdzAjwXySyJs0C83TvZeHTtwlJ X-Received: by 2002:a9d:7410:: with SMTP id n16mr14462534otk.23.1576836159184; Fri, 20 Dec 2019 02:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576836159; cv=none; d=google.com; s=arc-20160816; b=kOVCYb/ICBFsnF+G/JlmIL+nB4iwXJmSikWF9mMQvFvuulXZfV+fuJgKwpPPWaiuy6 LH8xZ35q5pFwGAMvbogmNaamaKKEN4zHPnleKhFgm+4LOofV0OHiDWMMIjP8O/plIL2L cWTy+GlUeHgmgpEuokKYnWJqgt7TOTYkDPulbdkpez06Ni+rnlLRfkjeJD+3Z4Uuk2bM fYSXTpXRzEce5AbxRlBFXlckx/yvy5OAHPEThttAd/YzyKyD5p5Ks5R8vJ+nhi+CJtXr ZkcKHC860DRzHoB716T5JOh+oPgsQkixbcXx1RhxCmE6eqVJxeR4hMVMTfkwKjahsfyb NX8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wboPPEei1XiVNkDt31D2yRaQW4+eIhEEINuouiM8mHs=; b=JwEVjEo7Y/RTo7m5/v4nMFfhrcKQ9gBEnVh7B0s3c/bdwpV3YeCY7yCd7z6H00yChL yWlzT81vFa167pJ/QhKfgt5h1BdYN/N671z/mtbzNFmZ4QkRH9b2GrcjFpQVNnnG6RBq EIjOH1/a8PPk82C4zxO4f4tWYWTkMQdlpKxWS4UpvG17TPy4fMXqKDoGuEe6kvZFxQq6 sghWNMo/BlcRo6lPsNXiBMs2aFzVs8mZg2GydRh0GewsraW1H/+grwNDeIlVh1MRr6Fs kpxM3IXJhps6bMf8ZwD99gASa1ZgimyWmo6VmoVMmNtOdoD4b7lWFfjhlM9TsFNNNObM zr3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=liu0G248; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si4671409oif.20.2019.12.20.02.02.25; Fri, 20 Dec 2019 02:02:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=liu0G248; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfLTKAv (ORCPT + 99 others); Fri, 20 Dec 2019 05:00:51 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:40686 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727125AbfLTKAv (ORCPT ); Fri, 20 Dec 2019 05:00:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wboPPEei1XiVNkDt31D2yRaQW4+eIhEEINuouiM8mHs=; b=liu0G248vBLt3Qt+Ml3sDhNlh tezLJ/pa61Z8Xhs06DZMX2gql+tWaeJboBSKoye+Cf/KqEe6UcMQgD7mdk7HHAvfE1Vx+0Qy5vNyx jb0/gzwzvmXPtG5N+uScPU15AFjkkebxz+Y7bi4RLxv2I4JToK0A5KskndSo5xPi/fsDQ7EAVvhfy 0yRFFhuer/eFrSSJ3w3iDwIAR6J1qkxRzdv2vlaz1CswR3UTbw0Dz0gnWmh+RkO20VsOPVX31ylRg na/Zpukcnils7eh9/A4Tjw3ZscY9TNX6ApjU4/KOIjTF8CqhqacmwK/L7mLR2wcSK0BTpQIAkT4IB 7UAbmeVsw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiF5I-0004aP-Pv; Fri, 20 Dec 2019 10:00:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 03A5D30073C; Fri, 20 Dec 2019 10:59:09 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E05A72B4061B0; Fri, 20 Dec 2019 11:00:33 +0100 (CET) Date: Fri, 20 Dec 2019 11:00:33 +0100 From: Peter Zijlstra To: Rasmus Villemoes Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Kirill Tkhai , Kirill Tkhai , "mingo@redhat.com" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "dietmar.eggemann@arm.com" , "bsegall@google.com" , "mgorman@suse.de" , Ingo Molnar , Andrew Morton Subject: Re: [RFC][PATCH 1/4] sched: Force the address order of each sched class descriptor Message-ID: <20191220100033.GE2844@hirez.programming.kicks-ass.net> References: <20191219214451.340746474@goodmis.org> <20191219214558.510271353@goodmis.org> <0a957e8d-7af8-613c-11ae-f51b9b241eb7@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a957e8d-7af8-613c-11ae-f51b9b241eb7@rasmusvillemoes.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 20, 2019 at 09:52:37AM +0100, Rasmus Villemoes wrote: > On 19/12/2019 22.44, Steven Rostedt wrote: > > From: "Steven Rostedt (VMware)" > > > > In order to make a micro optimization in pick_next_task(), the order of the > > sched class descriptor address must be in the same order as their priority > > to each other. That is: > > > > &idle_sched_class < &fair_sched_class < &rt_sched_class < > > &dl_sched_class < &stop_sched_class > > > > In order to guarantee this order of the sched class descriptors, add each > > one into their own data section and force the order in the linker script. > > I think it would make the code simpler if one reverses these, see other > reply. I started out agreeing, because of that mess around STOP_SCHED_CLASS and that horrid BEFORE_CRUD thing. Then, when I fixed it all up, I saw what it did to Kyrill's patch (#4) and that ends up looking like: - if (likely((prev->sched_class == &idle_sched_class || - prev->sched_class == &fair_sched_class) && + if (likely(prev->sched_class >= &fair_sched_class && And that's just weird. Then I had a better look and now... > > +/* > > + * The order of the sched class addresses are important, as they are > > + * used to determine the order of the priority of each sched class in > > + * relation to each other. > > + */ > > +#define SCHED_DATA \ > > + *(__idle_sched_class) \ > > + *(__fair_sched_class) \ > > + *(__rt_sched_class) \ > > + *(__dl_sched_class) \ > > + STOP_SCHED_CLASS I'm confused, why does that STOP_SCHED_CLASS need magic here at all? Doesn't the linker deal with empty sections already by making them 0 sized? > > /* > > * Align to a 32 byte boundary equal to the > > * alignment gcc 4.5 uses for a struct > > @@ -308,6 +326,7 @@ > > #define DATA_DATA \ > > *(.xiptext) \ > > *(DATA_MAIN) \ > > + SCHED_DATA \ > > *(.ref.data) \ > > Doesn't this make the structs end up in .data (writable) rather than > .rodata? Right! That wants fixing.