From patchwork Tue Oct 3 16:18:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 114701 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2060938qgn; Tue, 3 Oct 2017 09:18:35 -0700 (PDT) X-Received: by 10.98.69.136 with SMTP id n8mr18049007pfi.291.1507047515406; Tue, 03 Oct 2017 09:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507047515; cv=none; d=google.com; s=arc-20160816; b=0SU3tqaKoyBdb0ONvt2dgLZKXpDBGfmt3YIo8F18VuBXkprWWSdIscRXIKD4S0fBkP FkVk/wr/K+lEia1lD2wVdCGZJT1ovrY9h14ASfjzhWgCoKQAm6T68VsI3kJzWQVIHySO D1SbKx9JicfKVugqUSyYk3tMhTEBFcKq7tlmGP23lTDyIvDRz4BhY2oI78pvYX0XltAG IekcigK+2DMa2pH0f3xiCuPzNQyMF2ClTaEAgdn5jJGk47CqTL+cnQNL599+qTMJyYbU P70GqU7IigTnvlF94q2R9kihTO8YZnwhCA8NFO6VRuPTi7UR6FYC5Jr+GawO7ARAYlRN yD1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=TpkveIpqbX3wzWd+pKDV3srAxDl9TUuj3UR8Nw0b7LI=; b=kxgm1tCLanzp/38ybPfGiEmsUXjBrY5knJMubvw+R5IzA9CX0KbwzE2+GFVYW1D5qx uBFszhi9S6/mK6Xc8mYlGqz5JMNCwwf9V8wr+wrc7HtK2VCZqtZj3xKmhfS6zYLJCOQI GcOstq/kFRSWmQl2ragobcWfq6ZCe6H8d6Jche7H643ZBXb+5fG05SoDDUgogos+OtC7 EteGxMGqVG8Ht7ZY4obGz01tm2yjo/myX9f+DrWlyqYXy/ka/fEV87anN4RM0L08pGYl f502btefQeP0vikR0sfmgHb2C2fvJjjL+v/ICmpFeFaDm34Y+mrf/JcOb7B8CI2+SXaU vrUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32si6595533ple.704.2017.10.03.09.18.35; Tue, 03 Oct 2017 09:18:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbdJCQSd (ORCPT + 26 others); Tue, 3 Oct 2017 12:18:33 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:50734 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbdJCQSV (ORCPT ); Tue, 3 Oct 2017 12:18:21 -0400 Received: by mail-oi0-f66.google.com with SMTP id y64so15173486oia.7; Tue, 03 Oct 2017 09:18:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TpkveIpqbX3wzWd+pKDV3srAxDl9TUuj3UR8Nw0b7LI=; b=bhagOhMmfVOU7FhDwZnylpJs+SNqME+br8QYVCJ3loVo9bE51X/CU+ck2uoHdDbF1c hf9AWR4dRdQAfvUbdqP6dW3HQU7XPaavR7NNzj23MIlzN09JCeRiU6aWFpoPNsKOYoBh PXaLGIB6TyFGbvO58MFsLBsq9STMJhSeN9m99NWm6kjWiK37Qyq7vTxMPgkro6yH80HY wHWDLU4RK7NuAzQWxfcTquWOyeIsE4WVxJ6ulCcY7lftoSZgK4BXWsoJzXcHsK6wYwl3 UGG7/3zkENm+SOXSsgWQ2nZVgIhhIsx+iXaN204dKyZPZOZlpmuDSetmRyKj0lADFfEY PWDA== X-Gm-Message-State: AMCzsaW37skcL04F+wgKOevl11BoCiIwjp7tzt+1sDUYe6nJXoJsbDAF fVu9m2XKStAS629AX7G/xaMWd7Q= X-Google-Smtp-Source: AOwi7QBIRKPsPWTe25bzxmO6Qjp7aGmnoiULD5fX+umEnsK159ZONHOn6lgwiFig9r6Wx2OHBd5UKA== X-Received: by 10.202.253.213 with SMTP id b204mr3691031oii.101.1507047500669; Tue, 03 Oct 2017 09:18:20 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id y90sm4334451ota.52.2017.10.03.09.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 09:18:20 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Nicolas Pitre , Frank Rowand Subject: [PATCH 2/2] of/fdt: skip unflattening of disabled nodes Date: Tue, 3 Oct 2017 11:18:15 -0500 Message-Id: <20171003161815.25999-2-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171003161815.25999-1-robh@kernel.org> References: <20171003161815.25999-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- For more background, see this presentation from Nico: https://connect.linaro.org/resource/sfo17/sfo17-100/ drivers/of/fdt.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.11.0 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;