mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 王擎 <wangqing@vivo.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched: topology: make cache topology separate from cpu topology
Date: Sat, 2 Apr 2022 09:34:04 +0000	[thread overview]
Message-ID: <SL2PR06MB308281BAC7D7F7CBF136DCD3BDE39@SL2PR06MB3082.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <CAKfTPtCn0As7Kbj7aHtmu++RDyo8proM6k9DLa1AMAc7iSSQXg@mail.gmail.com>


>>
>>
>> >>
>> >>
>> >> >>
>> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> >On Thu, 10 Mar 2022 at 13:59, Qing Wang <wangqing@vivo.com> wrote:
>> >> >> >> >>
>> >> >> >> >> From: Wang Qing <wangqing@vivo.com>
>> >> >> >> >>
>> >> >> >> >> Some architectures(e.g. ARM64), caches are implemented below:
>> >> >> >> >> cluster:                     ****** cluster 0 *****      ****** cluster 1 *****
>> >> >> >> >> core:                         0      1          2      3          4      5           6      7
>> >> >> >> (add cache level 1)        c0    c1        c2    c3         c4    c5         c6    c7
>> >> >> >> >> cache(Leveln):         **cache0**  **cache1**  **cache2**  **cache3**
>> >> >> >> (add cache level 3)        *************share level 3 cache ***************
>> >> >> >> >> sd_llc_id(current):     0      0          0      0          4      4           4      4
>> >> >> >> >> sd_llc_id(should be): 0      0          2      2          4      4           6      6
>> >> >> >> >>
>> >> >> >> Here, n always be 2 in ARM64, but others are also possible.
>> >> >> >> core[0,1] form a complex(ARMV9),  which share L2 cache, core[2,3] is the same.
>> >> >> >>
>> >> >> >> >> Caches and cpus have different topology, this causes cpus_share_cache()
>> >> >> >> >> return the wrong value, which will affect the CPU load balance.
>> >> >> >> >>
>> >> >> >> >What does your current scheduler topology  look like?
>> >> >> >> >
>> >> >> >> >For CPU 0 to 3, do you have the below ?
>> >> >> >> >DIE [0     -     3] [4-7]
>> >> >> >> >MC  [0] [1] [2] [3]
>> >> >> >>
>> >> >> >> The current scheduler topology consistent with CPU topology:
>> >> >> >> DIE  [0-7]
>> >> >> >> MC  [0-3] [4-7]  (SD_SHARE_PKG_RESOURCES)
>> >> >> >> Most Android phones have this topology.
>> >> >> >> >
>> >> >> >> >But you would like something like below for cpu 0-1 instead ?
>> >> >> >> >DIE [0     -     3] [4-7]
>> >> >> >> >CLS [0 - 1] [2 - 3]
>> >> >> >> >MC  [0] [1]
>> >> >> >> >
>> >> >> >> >with SD_SHARE_PKG_RESOURCES only set to MC level ?
>> >> >> >>
>> >> >> >> We don't change the current scheduler topology, but the
>> >> >> >> cache topology should be separated like below:
>> >> >> >
>> >> >> >The scheduler topology is not only cpu topology but a mixed of cpu and
>> >> >> >cache/memory cache topology
>> >> >> >
>> >> >> >> [0-7]                          (shared level 3 cache )
>> >> >> >> [0-1] [2-3][4-5][6-7]   (shared level 2 cache )
>> >> >> >
>> >> >> >So you don't  bother the intermediate cluster level which is even simpler.
>> >> >> >you have to modify generic arch topology so that cpu_coregroup_mask
>> >> >> >returns the correct cpu mask directly.
>> >> >> >
>> >> >> >You will notice a llc_sibling field that is currently used by acpi but
>> >> >> >not DT to return llc cpu mask
>> >> >> >
>> >> >> cpu_topology[].llc_sibling describe the last level cache of whole system,
>> >> >> not in the sched_domain.
>> >> >>
>> >> >> in the above cache topology, llc_sibling is 0xff([0-7]) , it describes
>> >> >
>> >> >If llc_sibling was 0xff([0-7] on your system, you would have only one level:
>> >> >MC[0-7]
>> >>
>> >> Sorry, but I don't get it, why llc_sibling was 0xff([0-7] means MC[0-7]?
>> >> In our system(Android), llc_sibling is indeed 0xff([0-7]) , because they
>> >> shared the llc(L3), but we also have two level:
>> >> DIE [0-7]
>> >> MC [0-3][4-6]
>> >> It makes sense, [0-3] are little cores, [4-7] are bit cores, se only up migrate
>> >> when misfit. We won't change it.
>> >>
>> >> >
>> >> >> the L3 cache sibling, but sd_llc_id describes the maximum shared cache
>> >> >> in sd, which should be [0-1] instead of [0-3].
>> >> >
>> >> >sd_llc_id describes the last sched_domain with SD_SHARE_PKG_RESOURCES.
>> >> >If you want llc to be [0-3] make sure that the
>> >> >sched_domain_topology_level array returns the correct cpumask with
>> >> >this flag
>> >>
>> >> Acturely, we want sd_llc to be [0-1] [2-3], but if the MC domain don't have
>> >
>> >sd_llc_id refers to a scheduler domain but your patch breaks this so
>> >if you want a llc that reflects this topo:  [0-1] [2-3] you must
>> >provide a sched_domain level with this topo
>>
>> Maybe we should add a shared-cache level(SC), like what CLS does:
>>
>> DIE  [0-7] (shared level 3 cache, SD_SHARE_PKG_RESOURCES)
>> MC  [0-3] [4-7]  (not SD_SHARE_PKG_RESOURCES)
>> CLS  (if necessary)
>> SC    [0-1][2-3][4-5][6-7] (shared level 2 cache, SD_SHARE_PKG_RESOURCES)
>> SMT (if necessary)
>>
>> SC means a couple of CPUs which are placed closely by sharing
>> mid-level caches, but not enough to be a cluster.
>
>what you name SC above looks the same as CLS which should not be mixed
>with Arm cluster terminology

Do you mean cluster is equal to shared cache instead of containing, SC just 
means shared cache, but not form a cluster, a CLS can contain many SCs.

If as you said, SC looks the same as CLS, should we rename CLS to SC to 
avoid confusion?

Thanks,
Wang

  reply	other threads:[~2022-04-02  9:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 12:58 Qing Wang
2022-03-10 14:18 ` Vincent Guittot
2022-03-11  2:03   ` 王擎
2022-03-11  7:59     ` Vincent Guittot
2022-03-11  8:18       ` 王擎
2022-03-11  8:25         ` Vincent Guittot
2022-03-11  9:30           ` 王擎
2022-03-11 11:14             ` Vincent Guittot
2022-03-15  1:58               ` 王擎
2022-03-15 16:51                 ` Vincent Guittot
2022-04-02  9:34                   ` 王擎 [this message]
2022-04-02 10:29                     ` Yicong Yang
2022-04-04 12:31                     ` Vincent Guittot
2022-04-07  2:31                       ` 王擎
2022-03-10 17:35 ` kernel test robot
2022-03-11 11:24 ` Peter Zijlstra
2022-03-14  2:37   ` 王擎
2022-03-14 10:19     ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SL2PR06MB308281BAC7D7F7CBF136DCD3BDE39@SL2PR06MB3082.apcprd06.prod.outlook.com \
    --to=wangqing@vivo.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®