On 6/30/26 9:41 PM, Ridong Chen wrote:
@@ -3246,7 +3268,12 @@ ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
          return -EACCES;
        buf = strstrip(buf);
-    cpuset_full_lock();
+
+    /* cpuset_mutex acquired in wait_attach_done_lock() */
+    mutex_lock(&cpuset_top_mutex);
+    cpus_read_lock();
+    wait_attach_done_lock();
+

Would it be cleaner to just pass this into cpuset_full_lock() as a flag?

void cpuset_full_lock(bool wait_attach)
{
      mutex_lock(&cpuset_top_mutex);
      cpus_read_lock();
      if (wait_attach)
              wait_attach_done_lock();
      else
              mutex_lock(&cpuset_mutex);
}
Then the two write paths become a single cpuset_full_lock(true). The
downside is the other 6 callers would need cpuset_full_lock(false). Not sure it's worth it — what do you think?

I would like to put wait_attach_done_lock() at places where it will wait for the completion of the attach operation. Putting it inside cpuset_full_lock() will make it harder to find out which operations will need to wait for task attach. So I will keep the code as is.

Cheers,
Longman


Reply via email to