• Rafael J. Wysocki's avatar
    thermal: gov_bang_bang: Use governor_data to reduce overhead · 6e6f58a1
    Rafael J. Wysocki authored
    After running once, the for_each_trip_desc() loop in
    bang_bang_manage() is pure needless overhead because it is not going to
    make any changes unless a new cooling device has been bound to one of
    the trips in the thermal zone or the system is resuming from sleep.
    
    For this reason, make bang_bang_manage() set governor_data for the
    thermal zone and check it upfront to decide whether or not it needs to
    do anything.
    
    However, governor_data needs to be reset in some cases to let
    bang_bang_manage() know that it should walk the trips again, so add an
    .update_tz() callback to the governor and make the core additionally
    invoke it during system resume.
    
    To avoid affecting the other users of that callback unnecessarily, add
    a special notification reason for system resume, THERMAL_TZ_RESUME, and
    also pass it to __thermal_zone_device_update() called during system
    resume for consistency.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: default avatarPeter Kästle <peter@piie.net>
    Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
    Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
    Link: https://patch.msgid.link/2285575.iZASKD2KPV@rjwysocki.net
    6e6f58a1
thermal_core.c 47.7 KB