Re: [PATCH v1] thermal/core: change mm alloc method to avoid kernel warning

From: Junwen Wu
Date: Sun May 08 2022 - 11:25:46 EST


From: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>

On 19/04/2022 15:54, Zhang Rui wrote:
> CC Viresh.
>
> On Tue, 2022-04-19 at 11:14 +0200, Daniel Lezcano wrote:
>> On 19/04/2022 10:48, Zhang Rui wrote:
>>> large
>>>
>>> IMO, unless we can fix both places, I'd suggest we skip allocating
>>> and
>>> creating the broken trans_table attr. Like a prototype patch below
>>
>> Why not create a thermal debugfs with real useful information and
>> get
>> rid of this broken code ?
>
> The idea looks good to me.

>What about doing a percentile approach of the state indexes changes
>instead of a raw matrix full of zeros ? So we show the most significant
>transitions, perhaps something like:
>
>99%: 7->6 6->7
>98%: 6->5 5->6
>95%: 5->4 4->5
>90%: 7->5 5->7
>80%: 6->4 4->6
>70%: 7->1 7->2
>50%: ... ...

>total: 123456 124573


>And another statistics file containing some timings information like the
>total duration in mitigation, and the duration in the most significant
>states above?

Viresh, Zhang Rui, Daniel,sorry for the delay indeed ,the trans_table is always full of zero,
I introduce 'show_state' node(tunnable by user,default set as max_states/2) ,thus only show show_state'th trans count
to the max trans count change stats. in this way trans_table_show's buffer always less than PAGE_SIZE
I create a patch v2
like this:
/sys/class/thermal/cooling_device0/stats # cat trans_table
From : Index_change
state 0: ->1( 1) ->2( 2) ->7( 1)
state 1: ->0( 1) ->2( 1)
state 2: ->0( 2) ->1( 1)

here is the patch: