On Mon, Mar 17, 2025 at 08:22:35AM -1000, Tejun Heo wrote: > Hello, > > On Mon, Mar 17, 2025 at 06:53:24PM +0100, Andrea Righi wrote: > > +/* > > + * Return the subset of @cpus that task @p can use or NULL if none of the > > + * CPUs in the @cpus cpumask can be used. > > + */ > > +static const struct cpumask *task_cpumask(const struct task_struct *p, const struct cpumask *cpus, > > + struct cpumask *local_cpus) > > task_cpus_allowed_and()? It also would help to add comment explaining the > parameters as the function is a bit unusual. Ack. > > > +{ > > + /* > > + * If the task is allowed to run on all CPUs, simply use the > > + * architecture's cpumask directly. Otherwise, compute the > > + * intersection of the architecture's cpumask and the task's > > + * allowed cpumask. > > + */ > > + if (!cpus || p->nr_cpus_allowed >= num_possible_cpus() || > > + cpumask_subset(cpus, p->cpus_ptr)) > > + return cpus; > > + > > + if (!cpumask_equal(cpus, p->cpus_ptr) && > > Hmm... isn't this covered by the preceding cpumask_subset() test? Here, cpus > is not a subset of p->cpus_ptr, so how can it be the same as p->cpus_ptr? Oh that's right, I missed that between all the refactoring, thanks for catching it. Will remove it. > > > + cpumask_and(local_cpus, cpus, p->cpus_ptr)) > > + return local_cpus; > > + > > + return NULL; > > and return values need some explanation too. Ok. Thanks, -Andrea