[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9059345-a41e-451e-adac-53fa7519fc5b@icloud.com>
Date: Tue, 2 Sep 2025 21:06:28 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Dave Ertman <david.m.ertman@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Leon Romanovsky <leon@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org,
Zijun Hu <zijun.hu@....qualcomm.com>
Subject: Re: [PATCH] driver core: auxiliary bus: Optimize auxiliary_match_id()
On 2025/9/2 20:51, Greg Kroah-Hartman wrote:
>> auxiliary_match_id() repeatedly calculates variable @match_size in the
>> for loop. however, the variable is fixed actually. so it is enough to
>> calculate the variable once.
>>
>> Optimize it by moving the logic calculating the variable out of the for
>> loop, and it result in:
>>
>> 1) calculate the variable once instead of repeatedly.
>> 2) it will return as early as possible if device name is unexpected,
>> namely, (@p == NULL).
>>
>> so this fix will improve performance.
> This isn't a "performant" path at all, is it?
>
agree.
the patch is to improve the function's logic a bit.
> I'm not disagreeing that calculating this all the time is a bad idea,
> but please be reasonable. If it can't be measured, you can't really say
> it will "improve performance" 🙂
Powered by blists - more mailing lists