Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp580318pxb; Tue, 15 Feb 2022 22:45:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRgM/omCPaJ3IgftMk9jsTEmsoyBT9Rd36fZEDxqjsvizC8uqGuvCJN8o4rcJYhwjW4/sQ X-Received: by 2002:a65:6bc8:0:b0:35e:6447:43db with SMTP id e8-20020a656bc8000000b0035e644743dbmr1127089pgw.187.1644993957036; Tue, 15 Feb 2022 22:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644993957; cv=none; d=google.com; s=arc-20160816; b=XjOoaj0l8EoFDI+qor5K9Whjkpr/4OCa1VyVmSb/fX851p4RSmYq02L74oNfbMdksU R2N24gKNUcCVtCecAkzjuEUM19cbHfw77f9NWMEWMzOUkUsP5jJd+X7baEKQ7+R1sNww z4zWtr7A6GDIkeas4BJqT4neecPld3ibnOLkD5J//Q8sXpnhwZh7x0En+PYdCIbuj5ax 0CDS4V5ZQYzhzcvVHuvYQBLMgU2Me9GZEmq6JU57/IxSWzxCC/2pyTdy3S0fPqD7l1Ti JaryzMSQwY+RhsTQX7vJNTLcGeWwJaRz598qix3WwWlvfhOJHcbRp5VEZV/j5tVGiGTK U7Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Vfxjv7E56iaOFRTCObvj3BvVuslFzvG2n3OckI8Aumw=; b=o0xPUJiVI2+btiK6sGYl+h7W+Pr6tz4mLWZ9tf2ILLiTAL3lOOfaqUK34TXJfC5ckE E6Ir9wfJh4tgcPX7gVl/rDCLFup/7PIIvPT2jTd4CaDd9D4LOMHRaVQQxbvC6seEQJI8 GvnaWVSK4ZhgkJw75ZXa65Saaj9S6E3E6pADZ96sg9sZzJp4Mkx8nFPxxpLmlTWvgpeV iMlo4DBp0NbCT37SBei4Y5c8yhsJ7GrQtbYGXFGUOphvup1hst7N9zyxCCEoWdios+es T36G1wxHaj+4z11gVIqW+Zk9Wufdok3rhMTanQLohCMcOG9hnUJ59DLL+fSCd3lFrjeV Hw4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ud/+h1cD"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g14si5259682pgw.539.2022.02.15.22.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:45:57 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ud/+h1cD"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED5727923F; Tue, 15 Feb 2022 22:32:36 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239638AbiBOVxf (ORCPT + 99 others); Tue, 15 Feb 2022 16:53:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234702AbiBOVxe (ORCPT ); Tue, 15 Feb 2022 16:53:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1268BB5601 for ; Tue, 15 Feb 2022 13:53:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98057B81D0C for ; Tue, 15 Feb 2022 21:53:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 498DCC340EC for ; Tue, 15 Feb 2022 21:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644962001; bh=Vfxjv7E56iaOFRTCObvj3BvVuslFzvG2n3OckI8Aumw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ud/+h1cDLctFXinnhjFDRa48kZs/Sv+52aBGhae3CUMR1ixHIyIH5oYqHkxx9XxE9 7YOMVJHo9ApG1yi86kyolWpX24iIZ5CKk0M7Efr0GaH2lRN09W8+tfOSi9CEEwaBgW F287c+HHEKXmgQjnXSbK8ljE5Zvb3vUO/A99T7aq1++sTdgtjqLlhHGYN0LX/iaxtL fAoLjjkmkJZnfigW7zjsYIrhhhP5rsqvqIX8tovq1acLLuab8QzCMidGE9xcUXIbHx aZ0wI+UffNxCzoesfDAlvnEwWezGtdxHOBYF4USCONazR2UrovVz7o9/+kA45D0g3u UV1O4Cw/kMenA== Received: by mail-ed1-f52.google.com with SMTP id u18so555927edt.6 for ; Tue, 15 Feb 2022 13:53:21 -0800 (PST) X-Gm-Message-State: AOAM533mqAveGr/9IV1J1YllxhS3cBejHXkCT2UXVcibBysz1ewZOrri aWS2R07I5uwLuBhcu7uGqlGbHuwZVJclwcO4Pg== X-Received: by 2002:a50:e68d:: with SMTP id z13mr993946edm.307.1644961999559; Tue, 15 Feb 2022 13:53:19 -0800 (PST) MIME-Version: 1.0 References: <20220214203132.4722-1-alyssa.rosenzweig@collabora.com> In-Reply-To: <20220214203132.4722-1-alyssa.rosenzweig@collabora.com> From: Rob Herring Date: Tue, 15 Feb 2022 15:53:07 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/panfrost: Dynamically allocate pm_domains To: Alyssa Rosenzweig Cc: dri-devel , Tomeu Vizoso , Steven Price , David Airlie , Daniel Vetter , "linux-kernel@vger.kernel.org" , AngeloGioacchino Del Regno Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 14, 2022 at 2:31 PM Alyssa Rosenzweig 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