[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <168727529919.3637328.11452341509705803196.robh@kernel.org>
Date: Tue, 20 Jun 2023 09:35:00 -0600
From: Rob Herring <robh@...nel.org>
To: Stephan Gerhold <stephan@...hold.net>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Frank Rowand <frowand.list@...il.com>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Rob Herring <robh+dt@...nel.org>,
devicetree-spec@...r.kernel.org, devicetree@...r.kernel.org,
Bjorn Andersson <andersson@...nel.org>,
Andy Gross <agross@...nel.org>
Subject: Re: [PATCH v2 2/2] of: reserved_mem: Use stable allocation order
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@...hold.net>
> ---
> drivers/of/of_reserved_mem.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
Applied, thanks!
Powered by blists - more mailing lists