On Mon, Feb 14, 2022 at 2:31 PM Alyssa Rosenzweig <alyssa.rosenzweig@xxxxxxxxxxxxx> wrote: > > MT8192 requires 5 power domains. Rather than bump MAX_PM_DOMAINS and > waste memory on every supported Panfrost chip, instead dynamically > allocate pm_domain_devs and pm_domain_links. This adds some flexibility; > it seems inevitable a new MediaTek device will require more than 5 > domains. > > On non-MediaTek devices, this saves a small amount of memory. How much? You measured it? It's not that simple. kmalloc has finite allocation sizes (see /proc/slabinfo). So unless panfrost_device shrinks or grows to the next smaller or larger size, the memory used doesn't change. And each devm_kmalloc adds its own overhead as well. I'd do the oneliner changing it to 5 and be done with it. That being said, we have plenty of examples of doing this both ways, so whatever makes people happy. Rob