xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Carlo Nonato <carlo.nonato@minervasys.tech>
Cc: andrew.cooper3@citrix.com, george.dunlap@citrix.com,
	julien@xen.org, stefano.stabellini@amd.com, wl@xen.org,
	marco.solieri@unimore.it, andrea.bastoni@minervasys.tech,
	lucmiccio@gmail.com,
	Marco Solieri <marco.solieri@minervasys.tech>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 06/12] xen/common: add cache coloring allocator for domains
Date: Thu, 13 Oct 2022 12:44:21 +0200	[thread overview]
Message-ID: <097a6db1-51e4-3b6e-af94-46fef203b27a@suse.com> (raw)
In-Reply-To: <CAG+AhRWXi8V142aSx_P1cjyaXTb+CnS-EOB_o8c4Y7ZkBt7Gkg@mail.gmail.com>

On 13.10.2022 11:47, Carlo Nonato wrote:
> On Mon, Sep 19, 2022 at 8:26 AM Jan Beulich <jbeulich@suse.com> wrote:
>> On 16.09.2022 18:05, Carlo Nonato wrote:
>>> On Thu, Sep 15, 2022 at 3:13 PM Jan Beulich <jbeulich@suse.com> wrote:
>>>> On 26.08.2022 14:51, Carlo Nonato wrote:
>>>>> --- a/xen/arch/arm/coloring.c
>>>>> +++ b/xen/arch/arm/coloring.c
>>>>> @@ -300,6 +300,16 @@ void prepare_color_domain_config(struct xen_arch_domainconfig *config,
>>>>>      config->num_colors = (uint16_t)num;
>>>>>  }
>>>>>
>>>>> +unsigned int page_to_color(struct page_info *pg)
>>>>
>>>> The parameter will want to be pointer-to-const and I wonder whether ...
>>>>
>>>>> +{
>>>>> +    return addr_to_color(page_to_maddr(pg));
>>>>> +}
>>>>
>>>> ... the function as a whole wouldn't be a good candidate for being an
>>>> inline one (requiring addr_to_color() to be available in outside of
>>>> this file, of course).
>>>
>>> You mean defining it as static inline in the coloring.h header?
>>
>> That would seem preferable for a simple function like this one.
>>
> 
> I didn't want to expose that function since I would also have to expose
> the addr_col_mask global variable.
> Same goes for get_max_colors(): it exist only for the purpose to restrict
> the max_colors variable visibility.

Ah yes, that's a good reason to keep the function out-of-line.

>>>>> +    page_list_for_each( pos, head )
>>>>> +    {
>>>>> +        if ( page_to_maddr(pos) < page_to_maddr(pg) )
>>>>> +        {
>>>>> +            head = &pos->list;
>>>>> +            break;
>>>>> +        }
>>>>> +    }
>>>>
>>>> Wait - a linear search for every single page insertion? How well
>>>> is that going to perform on a multi-terabyte system?
>>>
>>> For our test cases (embedded systems) the linear search is good enough.
>>> I agree with you that in the general case this is bad (even though the main
>>> targets are indeed embedded systems).
>>> Are there any already available data structures that we can exploit to get
>>> better performances?
>>
>> I'm afraid there aren't any that I would see as a good fit here.
>>
> 
> Regarding this I can see three options:
> 1) We leave it as it is and we warn the user in the docs that cache coloring
>    is embedded system specific for the moment since it has, probably, bad
>    performances with bigger systems.

I could live with this as long as it's stated prominently enough, but ...

> 2) We use some priority queue implementation to replace the actual lists.
>    Red/black trees are available in Xen codebase, but I think I would have
>    to change the page_info struct to use them.
>    Maybe just a binary heap implemented as an array could be viable, but that
>    would require me to implement somewhere the logic for insertion,
>    extract-min and other operations.
> 3) I have a working prototype of a buddy allocator that also makes use of
>    coloring information. It isn't an extension of the main one, but rather a
>    simpler version. This means that nodes, zones, scrubbing, aren't
>    supported, but this is true also for the already submitted colored
>    allocator. With this, order > 0 pages can be served (up until
>    log2(max_colors)) and insertion is no more linear, but constant instead.

... this sounds even more promising, not the least because it also eliminates
yet another shortcoming we've talked about already. In fact I would expect
that log2(max_colors) doesn't need to be the limit either, as you'd cycle
back to the first color anyway once you've reached the last one.

Jan


  reply	other threads:[~2022-10-13 10:44 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 12:50 [PATCH 00/12] Arm cache coloring Carlo Nonato
2022-08-26 12:51 ` [PATCH 01/12] xen/arm: add cache coloring initialization Carlo Nonato
2022-09-26  6:20   ` Wei Chen
2022-09-26  7:42     ` Jan Beulich
2022-09-27 14:31       ` Carlo Nonato
2022-10-21 17:14   ` Julien Grall
2022-08-26 12:51 ` [PATCH 02/12] xen/arm: add cache coloring initialization for domains Carlo Nonato
2022-09-26  6:39   ` Wei Chen
2022-09-27 14:31     ` Carlo Nonato
2022-10-21 17:25     ` Julien Grall
2022-10-21 18:02   ` Julien Grall
2022-10-25 10:53     ` Carlo Nonato
2022-10-25 11:15       ` Julien Grall
2022-10-25 11:51         ` Andrea Bastoni
2022-11-07 13:44         ` Carlo Nonato
2022-11-07 18:24           ` Julien Grall
2023-01-26 12:05     ` Jan Beulich
2023-01-26 12:07     ` Jan Beulich
2022-10-21 18:04   ` Julien Grall
2022-08-26 12:51 ` [PATCH 03/12] xen/arm: dump cache colors in domain info debug-key Carlo Nonato
2022-08-26 12:51 ` [PATCH 04/12] tools/xl: add support for cache coloring configuration Carlo Nonato
2022-10-21 18:09   ` Julien Grall
2022-08-26 12:51 ` [PATCH 05/12] xen/arm: add support for cache coloring configuration via device-tree Carlo Nonato
2022-08-26 12:51 ` [PATCH 06/12] xen/common: add cache coloring allocator for domains Carlo Nonato
2022-09-15 13:13   ` Jan Beulich
2022-09-16 16:05     ` Carlo Nonato
2022-09-19  6:26       ` Jan Beulich
2022-09-19 22:42         ` Stefano Stabellini
2022-09-20  7:54           ` Jan Beulich
2022-10-13  9:47         ` Carlo Nonato
2022-10-13 10:44           ` Jan Beulich [this message]
2022-10-17  7:06   ` Michal Orzel
2022-10-17  8:44     ` Julien Grall
2022-10-17  9:16       ` Michal Orzel
2022-08-26 12:51 ` [PATCH 07/12] xen/common: add colored heap info debug-key Carlo Nonato
2022-08-26 14:13   ` Jan Beulich
2022-08-26 16:04     ` Carlo Nonato
2022-08-26 12:51 ` [PATCH 08/12] Revert "xen/arm: setup: Add Xen as boot module before printing all boot modules" Carlo Nonato
2022-09-10 14:01   ` Julien Grall
2022-09-12 13:54     ` Carlo Nonato
2022-10-21 16:52       ` Julien Grall
2022-08-26 12:51 ` [PATCH 09/12] Revert "xen/arm: mm: Initialize page-tables earlier" Carlo Nonato
2022-09-10 14:28   ` Julien Grall
2022-09-12 13:59     ` Carlo Nonato
2022-08-26 12:51 ` [PATCH 10/12] Revert "xen/arm: Remove unused BOOT_RELOC_VIRT_START" Carlo Nonato
2022-08-26 12:51 ` [PATCH 11/12] xen/arm: add Xen cache colors command line parameter Carlo Nonato
2022-08-26 12:51 ` [PATCH 12/12] xen/arm: add cache coloring support for Xen Carlo Nonato
2022-09-10 15:22   ` Julien Grall
2022-09-10 15:23     ` Julien Grall
2022-09-15 13:25   ` Jan Beulich
2022-09-16 16:07     ` Carlo Nonato
2022-09-19  8:38       ` Jan Beulich
2022-09-27 14:31         ` Carlo Nonato
2022-09-27 15:28           ` Jan Beulich
2022-09-10 15:12 ` [PATCH 00/12] Arm cache coloring Julien Grall
2022-09-12 13:24   ` Carlo Nonato
2022-09-15 13:29 ` Jan Beulich
2022-09-15 14:52   ` Marco Solieri
2022-09-15 18:15   ` Stefano Stabellini
2022-10-22 15:13 ` Julien Grall

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=097a6db1-51e4-3b6e-af94-46fef203b27a@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrea.bastoni@minervasys.tech \
    --cc=andrew.cooper3@citrix.com \
    --cc=carlo.nonato@minervasys.tech \
    --cc=george.dunlap@citrix.com \
    --cc=julien@xen.org \
    --cc=lucmiccio@gmail.com \
    --cc=marco.solieri@minervasys.tech \
    --cc=marco.solieri@unimore.it \
    --cc=stefano.stabellini@amd.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).