Page MenuHomeFreeBSD

g_eli: better handling of absent/disabled CPUs
ClosedPublic

Authored by mhorne on Fri, Jul 10, 5:31 PM.
Tags
None
Referenced Files
F162794147: D58157.diff
Thu, Jul 16, 11:33 PM
F162793753: D58157.diff
Thu, Jul 16, 11:27 PM
F162770937: D58157.id181736.diff
Thu, Jul 16, 5:30 PM
F162763102: D58157.diff
Thu, Jul 16, 2:45 PM
F162762759: D58157.diff
Thu, Jul 16, 2:38 PM
Unknown Object (File)
Wed, Jul 15, 10:34 AM
Unknown Object (File)
Tue, Jul 14, 9:14 PM
Unknown Object (File)
Tue, Jul 14, 1:04 AM
Subscribers

Details

Summary

Checking hlt_cpus_mask is a no-op, and the mask will be removed in the
next commit. However, we can use the more recent CPU_ABSENT() macro to
check the status.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/geom/eli/g_eli.c
1087

Why not use CPU_FOREACH() and break out of the loop if the counter >= threads?

olce added inline comments.
sys/geom/eli/g_eli.c
1087

I concur. In any case, the debug message does not seem useful and I'd remove it.

This revision is now accepted and ready to land.Fri, Jul 10, 7:13 PM
sys/geom/eli/g_eli.c
1087

I hoped for this, but it is difficult to handle both cases because CPU_FOREACH() embeds a CPU_ABSENT() check.

Let's take an example scenario:

  • g_eli_threads is set to some explicit value (!= mp_ncpus), e.g. 6.
  • The CPU map contains an absent CPU at index 2.

What will happen is that it will skip thread creation on i == 2, and break on loop i == 5, resulting in only 5 threads created.

So this ends up being the simplest change that does not further obfuscate things.

sys/geom/eli/g_eli.c
1087
for (i = 0;;) {
    CPU_FOREACH(k) {
          do_something_allocate_thread_on(k);
          if (++i >= threads)
             goto done;
     }
}
done:;
sys/geom/eli/g_eli.c
1087

I do not think this is better.

Let me propose a follow-up which disentangles the sc_cpubind and !sc_cpubind cases.