From: Rob Herring <robh@kernel.org>
To: Stephan Gerhold <stephan@gerhold.net>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Frank Rowand <frowand.list@gmail.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>,
devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org,
Bjorn Andersson <andersson@kernel.org>,
Andy Gross <agross@kernel.org>
Subject: Re: [PATCH v2 2/2] of: reserved_mem: Use stable allocation order
Date: Tue, 20 Jun 2023 09:35:00 -0600 [thread overview]
Message-ID: <168727529919.3637328.11452341509705803196.robh@kernel.org> (raw)
In-Reply-To: <20230510-dt-resv-bottom-up-v2-2-aeb2afc8ac25@gerhold.net>
On Wed, 14 Jun 2023 21:20:43 +0200, Stephan Gerhold wrote:
> sort() in Linux is based on heapsort which is not a stable sort
> algorithm - equal elements are being reordered. For reserved memory in
> the device tree this happens mainly for dynamic allocations: They do not
> have an address to sort with, so they are reordered somewhat randomly
> when adding/removing other unrelated reserved memory nodes.
>
> Functionally this is not a big problem, but it's confusing during
> development when all the addresses change after adding unrelated
> reserved memory nodes.
>
> Make the order stable by sorting dynamic allocations according to
> the node order in the device tree. Static allocations are not affected
> by this because they are still sorted by their (fixed) address.
>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
> drivers/of/of_reserved_mem.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
Applied, thanks!
prev parent reply other threads:[~2023-06-20 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 19:20 [PATCH v2 0/2] of: reserved_mem: Improve range allocations Stephan Gerhold
[not found] ` <20230510-dt-resv-bottom-up-v2-0-aeb2afc8ac25-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-06-14 19:20 ` [PATCH v2 1/2] of: reserved_mem: Try to keep range allocations contiguous Stephan Gerhold
[not found] ` <20230510-dt-resv-bottom-up-v2-1-aeb2afc8ac25-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-06-20 15:34 ` Rob Herring
2023-06-14 19:20 ` [PATCH v2 2/2] of: reserved_mem: Use stable allocation order Stephan Gerhold
2023-06-20 15:35 ` Rob Herring [this message]
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=168727529919.3637328.11452341509705803196.robh@kernel.org \
--to=robh@kernel.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree-spec@vger.kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=stephan@gerhold.net \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).