From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751776AbdJCV64 (ORCPT ); Tue, 3 Oct 2017 17:58:56 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35814 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbdJCV6y (ORCPT ); Tue, 3 Oct 2017 17:58:54 -0400 X-Google-Smtp-Source: AOwi7QB0lPybYYYnm4iEUqZGhedCbsXlIjC4WciRbqajL1yhsxXBqTE4cbx7dYOTWfzE+NI74q9gTA== Subject: Re: [PATCH 2/2] of/fdt: skip unflattening of disabled nodes To: Nicolas Pitre , Rob Herring References: <20171003161815.25999-1-robh@kernel.org> <20171003161815.25999-2-robh@kernel.org> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Frank Rowand Message-ID: <59D40813.4020009@gmail.com> Date: Tue, 3 Oct 2017 14:58:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/17 11:46, Nicolas Pitre wrote: > On Tue, 3 Oct 2017, Rob Herring wrote: > >> For static DT usecases, we don't need the disabled nodes and can skip >> unflattening. This saves a significant amount of RAM in memory constrained >> cases. In one example on STM32F469, the RAM usage goes from 118K to 26K. >> >> There are a few cases in the kernel that modify the status property >> dynamically. These all are changes from enabled to disabled, depend on >> OF_DYNAMIC or are not FDT based (PDT based). >> >> Cc: Nicolas Pitre >> Cc: Frank Rowand >> Signed-off-by: Rob Herring > > Tested-by: Nicolas Pitre > >> --- >> For more background, see this presentation from Nico: >> >> https://connect.linaro.org/resource/sfo17/sfo17-100/ > > Oh my ... this is horrible ... I found the presentation to be quite good and useful. The Linaro site does not have the slides, could you please send me a copy? Thanks, Frank > > /me hides in shame > >> >> drivers/of/fdt.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c >> index f8c39705418b..efe91c6856a0 100644 >> --- a/drivers/of/fdt.c >> +++ b/drivers/of/fdt.c >> @@ -396,6 +396,10 @@ static int unflatten_dt_nodes(const void *blob, >> if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) >> continue; >> >> + if (!IS_ENABLED(CONFIG_OF_DYNAMIC) && >> + !of_fdt_device_is_available(blob, offset)) >> + continue; >> + >> if (!populate_node(blob, offset, &mem, nps[depth], >> &nps[depth+1], dryrun)) >> return mem - base; >> -- >> 2.11.0 >> >> >