On Mon, 9 Mar 2026 13:52:20 -0600
Wesley Atwell <[email protected]> wrote:
> @@ -56,30 +89,48 @@ void trigger_data_free(struct event_trigger_data *data)
> if (data->cmd_ops->set_filter)
> data->cmd_ops->set_filter(NULL, data, NULL);
>
> + /*
> + * Boot-time trigger registration can fail before kthread creation
> + * works. Keep the deferred-free semantics during boot and let late
> + * init start the kthread to drain the list.
> + */
> + if (system_state == SYSTEM_BOOTING && !trigger_kthread) {
> + llist_add(&data->llist, &trigger_data_free_list);
> + return;
> + }
> +
> if (unlikely(!trigger_kthread)) {
> guard(mutex)(&trigger_data_kthread_mutex);
> - /* Check again after taking mutex */
> - if (!trigger_kthread) {
> - struct task_struct *kthread;
>
> - kthread = kthread_create(trigger_kthread_fn, NULL,
> - "trigger_data_free");
> - if (!IS_ERR(kthread))
> - WRITE_ONCE(trigger_kthread, kthread);
> + trigger_start_kthread_locked();
> + if (!trigger_kthread) {
> + llist_add(&data->llist, &trigger_data_free_list);
> + trigger_data_free_queued_locked();
> + return;
> }
> }
>
> - if (!trigger_kthread) {
> - /* Do it the slow way */
You removed the above comment. It's still relevant in the above if
statement.
-- Steve
> - tracepoint_synchronize_unregister();
> - kfree(data);
> - return;
> - }
> -
> llist_add(&data->llis