Skip to content

Draft: [th/rework-recheck-auto-activate] core: rework nm_policy_device_recheck_auto_activate_all_schedule()

Thomas Haller requested to merge th/rework-recheck-auto-activate into main
  1. nm_policy_device_recheck_auto_activate_schedule() now always enqueues the device for rechecking for autoconnect. It does not try to preemptively check and avoid scheduling the idle action. The benefit is, that we now always get the pending-action enqueued right away, even if it turns out later that autoconnect is not necessary. Note that with the changes of this branch, it became cheaper to queue the recheck (which was the reason for doing the pre-check previously and potentially short-cut some code). It still is not entirely cheap, because we will add and remove the "autoconnect" pending action. If that is a concern, NM_DEVICE_HAS_PENDING_ACTION handler should be more efficient by also only operating on an idle handler.

  2. let nm_policy_device_recheck_auto_activate_all_schedule() immediately iterate all devices and call nm_policy_device_recheck_auto_activate_schedule(). The benefit is that we now right away have the pending-action scheduled which blocks startup complete.

  3. don't have a separate idle action for each device. Instead, there is only one NMPolicyPrivate.auto_activate_idle_source. The idle callback only activates one device at a time and returns to the mainloop to proceed later. This simulates the previous behavior, and we want to give time to perform more important actions before autoconnecting another device.

  4. the flag NMPolicyPrivate.auto_activate_recheck_all_blocked aims to make multiple calls to nm_policy_device_recheck_auto_activate_all_schedule() cheaper. Now that nm_policy_device_recheck_auto_activate_schedule() always schedules a check, we don't need to call nm_policy_device_recheck_auto_activate_schedule() multiple times -- unless the idle action gets invoked or a new device added. Without point 1), this optimization would be cumbersome.

Merge request reports

Loading