Le Mon, Oct 21, 2024 at 07:01:02PM +0800, Z qiang a écrit :
> > For the non-nocb cpus set during boot, the corresponding
> > rcuop kthread, we should park directly, otherwise
> > WARN_ON_ONCE(!rcu_rdp_is_offloaded(rdp)) will be triggered.

Ah but this case is different. kthread_park() is called on
the kthread that is freshly created. In that case it is
parked before the kthread even had a chance to call its handler
(which is rcu_nocb_cb_kthread()).

See these lines in kthread():

        /* OK, tell user we're spawned, wait for stop or wakeup */
        __set_current_state(TASK_UNINTERRUPTIBLE);
        create->result = current;
        /*
         * Thread is going to call schedule(), do not preempt it,
         * or the creator may spend more time in wait_task_inactive().
         */
        preempt_disable();
        complete(done);
        schedule_preempt_disabled();
        preempt_enable();

        ret = -EINTR;
        if (!test_bit(KTHREAD_SHOULD_STOP, &self->flags)) {
                cgroup_kthread_ready();
                __kthread_parkme(self);
                ret = threadfn(data);
        }



So really rcu_rdp_is_offloaded() has to be true (but we can
warn if it's not. Though we already have a test for this in
nocb_cb_wait()).

Thanks.

Reply via email to