From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757644AbcHWKIQ (ORCPT ); Tue, 23 Aug 2016 06:08:16 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:43435 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754881AbcHWKH7 (ORCPT ); Tue, 23 Aug 2016 06:07:59 -0400 X-AuditID: cbfec7f4-f796c6d000001486-90-57bc207b94b6 Subject: Re: [PATCH 1/2] clk: samsung: exynos5260: Move struct samsung_cmu_info to init section To: Chanwoo Choi , Stephen Boyd References: <1471834185-20249-1-git-send-email-cw00.choi@samsung.com> <1471834185-20249-2-git-send-email-cw00.choi@samsung.com> <20160823005512.GP6502@codeaurora.org> <57BBB66E.2060807@samsung.com> Cc: tomasz.figa@gmail.com, mturquette@baylibre.com, kgene@kernel.org, k.kozlowski@samsung.com, chanwoo@kernel.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Sylwester Nawrocki Message-id: <84e40b9b-1e08-24e0-f1ef-60b38b760ae6@samsung.com> Date: Tue, 23 Aug 2016 12:07:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-version: 1.0 In-reply-to: <57BBB66E.2060807@samsung.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsVy+t/xa7rVCnvCDbYeM7eYeOMKi8X1L89Z LV6/MLTof/ya2WLT42usFh977rFaXN41h81ixvl9TBYXT7la/DjTzWKxatcfRgduj/c3Wtk9 Lvf1MnnsnHWX3WPTqk42j81L6j36tqxi9Pi8SS6APYrLJiU1J7MstUjfLoErY+m6DSwF/cIV vSt/sjcwbuTvYuTkkBAwkTi6/zgThC0mceHeerYuRi4OIYGljBKLH31lgnCeM0rMevyVEaRK WCBR4tGzi2AdIgK+EivWLYXqmMsksXbCCrAOZoGfjBKnGucwg1SxCRhK9B7tA+vmFbCT+Nsx Echm52ARUJV4qQYSFRWIkLi16iNUhaDEj8n3WEBsTgFtiROzNgLN5wAaqS4xZUouSJhZQF5i 85q3zBMYBWYh6ZiFUDULSdUCRuZVjKKppckFxUnpuYZ6xYm5xaV56XrJ+bmbGCGR8WUH4+Jj VocYBTgYlXh4d7DvDhdiTSwrrsw9xCjBwawkwqssvydciDclsbIqtSg/vqg0J7X4EKM0B4uS OO/cXe9DhATSE0tSs1NTC1KLYLJMHJxSDYw6oUHTzW8/Etn5KcpGt5spU2pHXfzXPuZltyOd 9xe8Ojzz3qYnfpER6RxzhAR8o1m6tcu/OIu56TMqh6/IcD2w3Wsno4KB1anW8ha992/X2Hw+ W7rqqpHAxuDg3gmHqhvYTFJ10oMfqZ44trV0Y+eFtiunptmyzZ9g4Vf382rzhcxdtk9j65VY ijMSDbWYi4oTAUTKXQiIAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/23/2016 04:35 AM, Chanwoo Choi wrote: >>> >>> +static const struct samsung_cmu_info aud_cmu __initconst = { >>> + .mux_clks = aud_mux_clks, >>> + .nr_mux_clks = ARRAY_SIZE(aud_mux_clks), >>> + .div_clks = aud_div_clks, >>> + .nr_div_clks = ARRAY_SIZE(aud_div_clks), >>> + .gate_clks = aud_gate_clks, >>> + .nr_gate_clks = ARRAY_SIZE(aud_gate_clks), >>> + .nr_clk_ids = AUD_NR_CLK, >>> + .clk_regs = aud_clk_regs, >>> + .nr_clk_regs = ARRAY_SIZE(aud_clk_regs), >>> +}; >>> + >>> static void __init exynos5260_clk_aud_init(struct device_node *np) >>> { >>> - struct samsung_cmu_info cmu = { NULL }; >>> - >> >> I presume this was done this way to save some initdata space by >> only allocating the array that's needed at runtime? I would >> expect to see some more kernel image bloat from this change but >> runtime memory usage would stay the same. Is there any real >> benefit from this patch though? >> > > After this patch, 'struct samsung_cmu_info' size should be added > to kernel image and then the size of deleted code should be removed > from kernel image. I think that it is not bloating. > (struct samsung_cmu_info includes the pointer and integer value.) > > This patch make the code more simple and improve the readability. > And, the samsung_cmu_register_on() requires the 'const' type > argument for 'struct samsung_cmu_info'. I checked stripped object files and it seems with the patch there is some saving of the kernel image size. Exactly 784 bytes, which makes zImage smaller by 480 bytes. The patch increases .init.rodata section size by 780 bytes but decreases .init.text section size by 1564 bytes. Looks like a static initializer is cheaper. $ ls -l drivers/clk/samsung/clk-exynos5260.o < -rw-rw-r-- 1 snawrocki snawrocki 29100 Aug 23 11:35 drivers/clk/samsung/clk-exynos5260.o --- > -rw-rw-r-- 1 snawrocki snawrocki 28316 Aug 23 11:32 drivers/clk/samsung/clk-exynos5260.o The section size differences are as below: 15c15 < 3 .init.text 000006b8 00000000 00000000 00000034 2**2 --- > 3 .init.text 0000009c 00000000 00000000 00000034 2**2 25c25 < 8 .init.rodata 00003f6c 00000000 00000000 00002f20 2**2 --- > 8 .init.rodata 00004278 00000000 00000000 00002904 2**2 So the saving is rather insignificant but the patch doesn't make things worse and I'd say it might be worth applying. -- Thanks, Sylwester