Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2937913ybl; Fri, 20 Dec 2019 00:54:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyvdTtx/h84cJMVu+UtfqJ+etIa3CIlIlxFxbJCEJ28Ya4OPsVCyEBhoDHGqLn6KExu8x2R X-Received: by 2002:a05:6830:2057:: with SMTP id f23mr9722000otp.110.1576832060183; Fri, 20 Dec 2019 00:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576832060; cv=none; d=google.com; s=arc-20160816; b=B0Y6WZWepUrHdyjyA7J8cF09TVJXWjzvMl36w/mP5EP9+8S9lDizE1ELvlRRFR4igB T4/jnCzjbxr/u7lruAVpIWAA1jkgP4hQijefFLP3DF53R7C+KAH5puDoccX+huilvuVK HYrra3UquIOdZc/ZNZQ5O/35HwIGrIFWzRwQdc3GDFhI2YaO1/67E56eT8pWW6tI5ViF qqYhFN06goDzEJrjBRYXYxuKlDmTgFde8ifxk3UXwN5L+VF7HWuypZVvXa8JSMoX6ZI9 1ipvhknsexgkNpYDDOrodn+8KdWip8I8LfoHIiQfmhd9Zs0xzt4g1/v1mG89MI+2U5Lm Ho5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zJ3lk8Uariqmq37DApYgBvr7+eUfRAGIy1QSR0W54j0=; b=l3cNnQcQhuBxiYWlBzVEjpnPzA9/b+akNDMQlaG7N6YYZIgZx0vvAE1AS90+gK0/pn /AFdz4l6Emn9CuRa3Bz5op8QN6SRCVdBfVvQeWOeFGYzXd5C5aEykhvDdFY4Q8r44Thg EsHEN9+3ep2W+xn5LFG6tkkt7YOjtkeLOmDfdviUoafUwzYt2nGe5yAvxqpGe3zG2za1 Xh9NLUBKQkVP3FfX/9HC9//0z24II7Um3p9oC/cY4tsq1KIO0zzAov4oCWxYXIbLwUkR Vvy6CTXwXGMjwR44+rsNk1gl8CBdjtRL+BLSDPJJ8ugvo6BdO2yOgdNAMPFsWanaHGYv i8rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="Hk/RPTpx"; 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 i124si4268754oif.214.2019.12.20.00.54.09; Fri, 20 Dec 2019 00:54:20 -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=pass header.i=@rasmusvillemoes.dk header.s=google header.b="Hk/RPTpx"; 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 S1727201AbfLTIwf (ORCPT + 99 others); Fri, 20 Dec 2019 03:52:35 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:38491 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbfLTIwf (ORCPT ); Fri, 20 Dec 2019 03:52:35 -0500 Received: by mail-lj1-f195.google.com with SMTP id k8so9185046ljh.5 for ; Fri, 20 Dec 2019 00:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zJ3lk8Uariqmq37DApYgBvr7+eUfRAGIy1QSR0W54j0=; b=Hk/RPTpx//p4v2hUzvG+2OOnvygI7UXjQ9GbryxEf+Lh4VSwZ0yGK6uPkEK+ElOfhB Qje/hqDv/1U9wKlx9Fd0JSK6I8q8K4Zve+j5qE8CV7FckQsPJOrH64zMYVj5lNv6UcJs 29qBQX22pGq2w1wRZIba9+QM6eZM91nBdFgVA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zJ3lk8Uariqmq37DApYgBvr7+eUfRAGIy1QSR0W54j0=; b=BKCsEm9Sw3yeqtddtePXpSItVDJfYagI7ojzJ+CMyM47AUqDyc4ckrznRv/XljZedb AAZzQdAs63hNmGz0wp1hoiCBQLncCWqMUz6CyF1k+rdBcwTqTUDfaNBge0kApU7GlnKm IN2z9fwGXrfSEsPY3LVadXS/YerXYnbmynuUwtQdeDtjVqpNgk2rftzgazyaCYu9qdN2 TqybM6xE0Eb2fW6kipqpaHcOfGbVqeiRxARWcmPVPeEZjS9cqywwUsyOVOqjX1KLbj51 UVwLrpsFprSGvW/UkHkgf1Dv1FRciQMbksSIrGsb20C6Pbxq8n7RFLjiH1v4mJAzfXqq oaaw== X-Gm-Message-State: APjAAAUi3WrWMTUjygyZlopc6beFEkalhmFOCYGNsAA5Id9aYfa1LAFn THFOJT7gzl9JFrPiSWPVV+U1XQ== X-Received: by 2002:a2e:8e22:: with SMTP id r2mr1432644ljk.51.1576831953303; Fri, 20 Dec 2019 00:52:33 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id r26sm3645912lfm.82.2019.12.20.00.52.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Dec 2019 00:52:32 -0800 (PST) Subject: Re: [RFC][PATCH 2/4] sched: Have sched_class_highest define by vmlinux.lds.h To: Steven Rostedt , linux-kernel@vger.kernel.org Cc: Kirill Tkhai , Kirill Tkhai , Peter Zijlstra , "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 References: <20191219214451.340746474@goodmis.org> <20191219214558.682913590@goodmis.org> From: Rasmus Villemoes Message-ID: <92b43ea2-6d21-fe5e-239a-c45d3484ada4@rasmusvillemoes.dk> Date: Fri, 20 Dec 2019 09:52:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191219214558.682913590@goodmis.org> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/12/2019 22.44, Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > Now that the sched_class descriptors are defined by the linker script, and > this needs to be aware of the existance of stop_sched_class when SMP is > enabled or not, as it is used as the "highest" priority when defined. Move > the declaration of sched_class_highest to the same location in the linker > script that inserts stop_sched_class, and this will also make it easier to > see what should be defined as the highest class, as this linker script > location defines the priorities as well. > > Signed-off-by: Steven Rostedt (VMware) > --- > include/asm-generic/vmlinux.lds.h | 11 ++++++++++- > kernel/sched/sched.h | 9 +++------ > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index 772d961c69a5..1c14c4ddf785 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -109,9 +109,16 @@ > #endif > > #ifdef CONFIG_SMP > -#define STOP_SCHED_CLASS *(__stop_sched_class) > +#define STOP_SCHED_CLASS \ > + STRUCT_ALIGN(); \ > + sched_class_highest = .; \ > + *(__stop_sched_class) > +#define BEFORE_DL_SCHED_CLASS > #else > #define STOP_SCHED_CLASS > +#define BEFORE_DL_SCHED_CLASS \ > + STRUCT_ALIGN(); \ > + sched_class_highest = .; > #endif > > /* > @@ -120,9 +127,11 @@ > * relation to each other. > */ > #define SCHED_DATA \ > + STRUCT_ALIGN(); \ > *(__idle_sched_class) \ > *(__fair_sched_class) \ > *(__rt_sched_class) \ > + BEFORE_DL_SCHED_CLASS \ > *(__dl_sched_class) \ > STOP_SCHED_CLASS If you reverse the ordering so the highest sched class comes first, this can just be sched_class_highest = . STOP_SCHED_CLASS *(__dl_sched_class) ... *(__idle_sched_class) __end_sched_classes = . and this from patch 3/4 #define for_class_range(class, _from, _to) \ - for (class = (_from); class != (_to); class = class->next) + for (class = (_from); class > (_to); class--) #define for_each_class(class) \ - for_class_range(class, &sched_class_highest, NULL) + for_class_range(class, &sched_class_highest, (&__start_sched_classes) - 1) can instead become + for (class = (_from); class < (_to); class++) and + for_class_range(class, &sched_class_highest, &__end_sched_classes) which seem somewhat more readable. And actually, I don't think you need the STOP_SCHED_CLASS define at all - in non-SMP, no object file has a __stop_sched_class section, so including *(__stop_sched_class) unconditionally will DTRT. (BTW, it's a bit confusing that stop_task.o is compiled in if CONFIG_SMP, but stop_task.c also has a #ifdef CONFIG_SMP). Rasmus