From patchwork Thu Oct 5 19:44:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 114986 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp957966qgn; Thu, 5 Oct 2017 12:44:29 -0700 (PDT) X-Received: by 10.99.134.194 with SMTP id x185mr16342118pgd.322.1507232669236; Thu, 05 Oct 2017 12:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507232669; cv=none; d=google.com; s=arc-20160816; b=UauadYDVBO5piv6aZZumt2IeUeFeyCYGtERMOVdXKTjaFsv6/BH1z3ruSMWGsXvYjd aHj7P7vsElZLf9hZNFjtlquXypPZbY6tjsvP5pFa7zH78Chq0E+K4yuDu30B8Xu2eUWT 8I/Bu5Nae0GUiiawUnxoxuPZOt0Hc47jY6JL4NdrSMjNYhlKvt9VHRgwfDoZmsE+n+Gk Qh9qpoYYUbTmTzfm5nfWcJPqyz4kaywl6q0JyxBp9II6zPybASMFlvxttuFhKVHgSFy4 Y1x+QQV9utY5xByRbKB7aXbo63pX8HOWhsRQG8TSVVCAlzthQ4A8ILzST4+HzQkqvUGs yJSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lVS5S5VB4AwqtbyTpoY+3DhCZfC0e7I+u4Mkz72OeQg=; b=faDMkjE0jY9SV0dUoh9OYATWFGXsdgI2+mnWPs8SJ8yBDGIXVHn5UNgqxxk9uAjO0T 1xCwj0K2+YqxJ6Ag4Kq+7Lzp+0HulqvfRPne/OM3igZEoZRXuH7onKxucKrgmM7dDJ5S WZvHf80Cgh7sHIOgmuyteAXE9+S8bFBnvujruP3Z8YH8BsCtdY7n3Zx056NKvUe3JjBv LmR1yeNX0ne95yHLKHACBLJYP8b/1ICO4PMet5J+ZPL0A6rNnKrppAOGKIro1k6u1JOk bPHtdA1yb46/zN0XF1xbf01Qlzourz8OnToL8ERIfik0Q+DlIlK9RLKPJsAQgmvqs5qu 7NsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 c6si10528381plr.557.2017.10.05.12.44.28; Thu, 05 Oct 2017 12:44:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751784AbdJETo1 (ORCPT + 6 others); Thu, 5 Oct 2017 15:44:27 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:38751 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdJETo1 (ORCPT ); Thu, 5 Oct 2017 15:44:27 -0400 Received: by mail-oi0-f67.google.com with SMTP id t134so2084030oih.5; Thu, 05 Oct 2017 12:44:26 -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; bh=/3s4es+p1DkZ8myedc1RpQoI75klQzd0sm1E0O5xf3g=; b=OQRfv2k8c+tieybpuKtQEWQTFFbDzky6y+zpzh23dUtmuYX2udeW24xFoSvCoK8PfB oXGs2VgHqvKZ4yNc/QeTR0/q/u/kr1Gdff5BeV6vXAEDiARrIeZu1O7HAIEEcI31u3Ur wLSSe3nMG8+LKzh99yj5B2zotUVTsrLYex9walXVlkHNBQ12uoLC31J+odKeO9ZkMVAG gHJeGuBqu4T5xDvCEB3q66np1Q3f29zcF7A46vTS6n4E2vBZi5lZnSJQe2P7VITRjevK zsaIFKVYrTMZjPoRKTbkjgi7lpu6o5rq/I4ukjhkt460B3Uz39M/52S5ta8VJIGcEfk5 yHnQ== X-Gm-Message-State: AMCzsaWwsRDdLc3TEbPn65Y0gRiP6xmBz/FnEPaHkmBPbnCQ54iRAk9U rcv5hJJXesom+tr8bIMCX/Y63QY= X-Google-Smtp-Source: AOwi7QBH2VR1A7z2XFPjzl89NfCi8CdPTY5l40jOpk+d+LTx4S5rO1EUMrDqJHyckIFKULXXMUHKmw== X-Received: by 10.157.81.197 with SMTP id d5mr1729800oth.11.1507232666309; Thu, 05 Oct 2017 12:44:26 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id b73sm9011795oii.1.2017.10.05.12.44.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 12:44:25 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Nicolas Pitre , Frank Rowand , Grant Likely Subject: [PATCH 0/6] Shrinking DT memory usage Date: Thu, 5 Oct 2017 14:44:16 -0500 Message-Id: <20171005194422.26224-1-robh@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On kernels with a minimal config and a RAM target in the 100s of KB, DT is quite a hog of runtime memory usage. How much is dependent on how many nodes and properties in the DT which have a corresponding struct device_node and struct property in the kernel. Just skipping disabled nodes saves a lot by not creating the device_nodes in the first place[1], but there's more low hanging fruit by making some of the fields in struct property and struct device_node optional. With the changes here, the memory usage goes from 17KB to under 8KB on QEMU's ARM virt machine which is a relatively small DT. The majority of the diffstat here is just moving all the kobject/sysfs related code to its own file so we can avoid adding a bunch of ifdefs. There's more drastic approaches we could take such as doing the unflattening at build time and storing the bulk of the unflattened tree as const data. Grant also has some ideas on storing properties as ids instead. He's explained it to me, but I still don't understand it. Rob [1] https://patchwork.kernel.org/patch/9983203/ Rob Herring (6): of: fix missing kobject init for !SYSFS && OF_DYNAMIC config of: remove struct property.unique_id for FDT of: make struct property _flags field configurable of: move kobj_to_device_node() into dynamic.c of: wrap accesses to device_node kobject of: make kobject and bin_attribute support configurable drivers/base/core.c | 2 +- drivers/of/Kconfig | 4 ++ drivers/of/Makefile | 1 + drivers/of/base.c | 133 --------------------------------------- drivers/of/dynamic.c | 27 ++------ drivers/of/kobj.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/of/of_private.h | 29 +++++++-- include/linux/of.h | 28 +++++---- 8 files changed, 215 insertions(+), 173 deletions(-) create mode 100644 drivers/of/kobj.c -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Frank Rowand