Hi Bertrand,
On 29/04/2024 08:20, Bertrand Marquis wrote:
From the comment in sched.h:
/*
* rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
* This is the preferred function if the returned domain reference
* is short lived, but it cannot be used if the domain reference needs
* to be kept beyond the current scope (e.g., across a softirq).
* The returned domain reference must be discarded using rcu_unlock_domain().
*/
Now the question of short lived should be challenged but I do not think we can
consider the current code as "long lived".
Actually, I am not entirely sure you can use put_domain() in interrupt
context. If you look at the implementation of domain_destroy() it takes
a spin lock without disabling the interrupts.
The same spinlock is taken in domain_create(). So there is a potential
deadlock.
Which means the decision between the two is not only about liveness.
Cheers,
--
Julien Grall