Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1917387ybl; Thu, 19 Dec 2019 05:13:52 -0800 (PST) X-Google-Smtp-Source: APXvYqy49FW/+Nza5fuVNEyRmBno8zPqUuvW9OrGLYoYzJFQQLLK+9pX8DO8g0tUpcbbBhPuybFs X-Received: by 2002:a9d:7501:: with SMTP id r1mr6133404otk.196.1576761232383; Thu, 19 Dec 2019 05:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576761232; cv=none; d=google.com; s=arc-20160816; b=o0ZtQftrwtLzE2pZz9V7U1f3V1DMi1qYW6RypXSIc65qKi9PFqNMPgeXJ3KauwI+Mt MtphsnCzFJnWfW70JamvUfpv+nIE6aDnhqotRfMOBFbKCxw/JT3JYY/jQZ9bQl6HVwIo Sg+k2xfWFR84B0yTKnIiLGhrg44NNMFCW98jwPrbFJEINoE1xET9QAgnVyiOYIeiSvds KYTgvntJeEy+jmNudULVokeeQxJP3lGRbNIPFreq/FL3yRKpCZJy84kMvGVnpVVpwfyv PFyD1yJwHrQ3Sev9NpOdtO09soURkd5F0SuEAcZhSl/FkVDBbYkZfLTEPN5ckkAPfwmg asyQ== 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=X2rxmFp1nN4MsfxtIvmlE76kILeHh88dwPXVZiG/rcc=; b=YQc53kokbFI5xI3qhnz6WFAfg9Q0dzR0KO8SOaYXcK+5sXHcO14KJmnEZ9IRzKxlh2 hB6IQJdmsabgSjDS/V0Itb6jFmNdfGwaGh6PBbHFc6j5obMbSr94guL7M1+MW6+j4/Q1 IW2dZuTKMJEbmeoCWBrrAplnks2wtzYW0DRZrcJYQMRds6o5SbeVwE0kFDv9vF4ICLLK nwN4Od3+yZrpMLF2xeTNHM0caEyyJ6/MmobqMnaEGe7l0gEt8oVbyyiBymQGbpNGsGwe 0YBkRZYeIT3r0WQYCm8q/+N2BSGJxZGZCsjgichpvf4t5mV0rZuunpt7uH2edfmSBQiu aoRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Y4ndwh0t; 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 m24si3327513otn.67.2019.12.19.05.13.36; Thu, 19 Dec 2019 05:13:52 -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=Y4ndwh0t; 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 S1726778AbfLSNM4 (ORCPT + 99 others); Thu, 19 Dec 2019 08:12:56 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:60714 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfLSNMz (ORCPT ); Thu, 19 Dec 2019 08:12:55 -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=X2rxmFp1nN4MsfxtIvmlE76kILeHh88dwPXVZiG/rcc=; b=Y4ndwh0tsVYEEvEZDSgCnUAwC 4F5CwU7Z9BQdZxHvnSoeKOxsw2z7wftTAWGMymZc+Ebc9UElG8eCiV7T/5lxavnWV09M/gZ2Sfbyl Z9W6HvrZ2qxnOQXKV00FLEbny+/ONiB0RnzP/S4aG5gMQ8+LMn4ETV5mNnh9Yv8MWdYdUXiOSzJVD e2RxNqZ9VzoMk4H9ZPSL5C78aaBAfPkDZwWl3WaltXVZcdmGtQPi3K8rMKjunV/jSYsmvrCnBwohm esrMXcEJW7q13+NW3OfoRVzKt8eUYaULJmav+m55KdFekV+ypmu5DoWKpWoFM/6iwTvC7s0lmTlrl pj3d+fB4Q==; 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 1ihvbg-0000Vn-9r; Thu, 19 Dec 2019 13:12:44 +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 885BC3007F2; Thu, 19 Dec 2019 14:11:18 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1B1782B3DB890; Thu, 19 Dec 2019 14:12:42 +0100 (CET) Date: Thu, 19 Dec 2019 14:12:42 +0100 From: Peter Zijlstra To: Kirill Tkhai Cc: mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] sched: Micro optimization in pick_next_task() and in check_preempt_curr() Message-ID: <20191219131242.GK2827@hirez.programming.kicks-ass.net> References: <157675913272.349305.8936736338884044103.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <157675913272.349305.8936736338884044103.stgit@localhost.localdomain> 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 Thu, Dec 19, 2019 at 03:39:14PM +0300, Kirill Tkhai wrote: > In kernel/sched/Makefile files, describing different sched classes, already > go in the order from the lowest priority class to the highest priority class: > > idle.o fair.o rt.o deadline.o stop_task.o > > The documentation of GNU linker says, that section appears in the order > they are seen during link time (see [1]): > > >Normally, the linker will place files and sections matched by wildcards > >in the order in which they are seen during the link. You can change this > >by using the SORT keyword, which appears before a wildcard pattern > >in parentheses (e.g., SORT(.text*)). > > So, we may expect const variables from idle.o will go before ro variables > from fair.o in RO_DATA section, while ro variables from fair.o will go > before ro variables from rt.o, etc. > > (Also, it looks like the linking order is already used in kernel, e.g. > in drivers/md/Makefile) > > Thus, we may introduce an optimization based on xxx_sched_class addresses > in these two hot scheduler functions: pick_next_task() and check_preempt_curr(). > > One more result of the patch is that size of object file becomes a little > less (excluding added BUG_ON(), which goes in __init section): > > $size kernel/sched/core.o > text data bss dec hex filename > before: 66446 18957 676 86079 1503f kernel/sched/core.o > after: 66398 18957 676 86031 1500f kernel/sched/core.o Does LTO preserve this behaviour? I've never quite dared do this exact optimization.