From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D43D4C433F5 for ; Wed, 10 Nov 2021 19:08:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0051C61058 for ; Wed, 10 Nov 2021 19:08:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0051C61058 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HqDrw2Fqyz3c7Y for ; Thu, 11 Nov 2021 06:08:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.222.49; helo=mail-ua1-f49.google.com; envelope-from=geert.uytterhoeven@gmail.com; receiver=) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HqDrR2gYbz2xDT for ; Thu, 11 Nov 2021 06:07:49 +1100 (AEDT) Received: by mail-ua1-f49.google.com with SMTP id ay21so6909440uab.12 for ; Wed, 10 Nov 2021 11:07:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JVkOVIMojOtjUqioksXn7GnT56ja9tgOLgQ+4277MEE=; b=uDx8NkfBxkkmGO2o51X/55tu3JhsUQTDFivtUxA01PNKnp/8NdoHGSenWY74x0/SsE uI+wLMAKXb8xKCzwUSL6pD+MxvHDqjGnmguZqcQ0sZWaGEKAXg+eEUHzrEnUyRoh0A3p YavhGVGEsdDscHcHbwZUCDyFNpE4r0M9XMfNISeMGtQGaK5v1FUtEWvtJ18I6Bi4g2FN 5ghnEVGyUkz5HbbI1fTFOXSlUkrbnuHpLb0rh8+ZKARfjGBUDEvWkJVaNZyuVTJ1pmhj ONOZJI3t1AkargILWSloDG0W2JxYiiaue29/9HU2i5tAs/4NU/2GUFe/H0Br8LgACZ1R I74A== X-Gm-Message-State: AOAM530Hg/Y+s/bijUGqIUXkWHXVH4oXu/AstXO6X+5DI2aZPpbRWiIm SiwCMLhuoDTZLfamesqRDSXJOeFHeKrRHg== X-Google-Smtp-Source: ABdhPJxwychUBp7BMLdYUL82kp+mptFdWE+UV53HDXI5gl16psotS/xWZEIp+dXXpHXMaja/Y804pg== X-Received: by 2002:a67:782:: with SMTP id 124mr1711372vsh.24.1636571265923; Wed, 10 Nov 2021 11:07:45 -0800 (PST) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com. [209.85.222.52]) by smtp.gmail.com with ESMTPSA id g187sm539782vsc.10.2021.11.10.11.07.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Nov 2021 11:07:45 -0800 (PST) Received: by mail-ua1-f52.google.com with SMTP id b17so7067002uas.0 for ; Wed, 10 Nov 2021 11:07:45 -0800 (PST) X-Received: by 2002:a05:6102:2910:: with SMTP id cz16mr2351290vsb.9.1636571265036; Wed, 10 Nov 2021 11:07:45 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Geert Uytterhoeven Date: Wed, 10 Nov 2021 20:07:33 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH/RFC] of: Shrink struct of_device_id To: Rasmus Villemoes Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linuxppc-dev , "open list:BROADCOM NVRAM DRIVER" , Linux Kernel Mailing List , Linux-Renesas , Rob Herring , linux-riscv , Frank Rowand , Linux ARM Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Rasmus, On Wed, Nov 10, 2021 at 5:51 PM Rasmus Villemoes wrote: > On 10/11/2021 17.23, Geert Uytterhoeven wrote: > > Currently struct of_device_id is 196 (32-bit) or 200 (64-bit) bytes > > large. It contains fixed-size strings for a name, a type, and a > > compatible value, but the first two are barely used. > > OF device ID tables contain multiple entries, plus an empty sentinel > > entry. > > > > Statistics for my current kernel source tree: > > - 4487 tables with 16836 entries (3367200 bytes) > > - 176 names (average 6.7 max 23 chars) > > - 66 types (average 5.1 max 21 chars) > > - 12192 compatible values (average 18.0 max 45 chars) > > Taking into account the minimum needed size to store the strings, only > > 6.9% of the allocated space is used... > > > > Reduce kernel size by reducing the sizes of the fixed strings by one > > half. > > Tried something like this 2.5 years ago: > https://lore.kernel.org/lkml/20190425203101.9403-1-linux@rasmusvillemoes.dk/ I wasn't aware of that. I reworked some code which used multiple of_find_compatible_node() calls before, and noticed the end result had grown a lot due to the sheer size of of_device_id ("[PATCH] soc: renesas: Consolidate product register handling", https://lore.kernel.org/all/057721f46c7499de4133135488f0f3da7fb39265.1636570669.git.geert+renesas@glider.be). > I think that there might be some not-in-tree code that relies on the > existing layout. I considered adding a CONFIG_ knob, either for these > sizes in particular, or more generally a def_bool y "CONFIG_LEGACY" > which embedded folks that build the entire distro from source and don't > have any legacy things can turn off, and then get more sensible defaults > all around. Most of that should have been gone since the #ifdef KERNEL was removed from include/linux/mod_devicetable.h in commit 6543becf26fff612 ("mod/file2alias: make modalias generation safe for cross compiling"). Of course you can never know for sure... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds