]> Git Repo - linux.git/commitdiff
Merge branch 'for-4.20-fixes' into for-4.21
authorTejun Heo <[email protected]>
Fri, 28 Dec 2018 02:05:30 +0000 (18:05 -0800)
committerTejun Heo <[email protected]>
Fri, 28 Dec 2018 02:05:30 +0000 (18:05 -0800)
1  2 
kernel/cgroup/cgroup.c

diff --combined kernel/cgroup/cgroup.c
index e06994fd4e34c29c48d3a941e8b74c5285d319fe,1f84977fab47558ee4c28891aa3b8cfa81fe85ea..8da9bf5e422f0f01d183e7d47e7c36bd1a22d083
@@@ -86,7 -86,6 +86,7 @@@ EXPORT_SYMBOL_GPL(css_set_lock)
  
  DEFINE_SPINLOCK(trace_cgroup_path_lock);
  char trace_cgroup_path[TRACE_CGROUP_PATH_LEN];
 +bool cgroup_debug __read_mostly;
  
  /*
   * Protects cgroup_idr and css_idr so that IDs can be released without
@@@ -1400,15 -1399,12 +1400,15 @@@ static char *cgroup_file_name(struct cg
        struct cgroup_subsys *ss = cft->ss;
  
        if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) &&
 -          !(cgrp->root->flags & CGRP_ROOT_NOPREFIX))
 -              snprintf(buf, CGROUP_FILE_NAME_MAX, "%s.%s",
 -                       cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
 +          !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) {
 +              const char *dbg = (cft->flags & CFTYPE_DEBUG) ? ".__DEBUG__." : "";
 +
 +              snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s",
 +                       dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
                         cft->name);
 -      else
 +      } else {
                strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
 +      }
        return buf;
  }
  
@@@ -3643,8 -3639,7 +3643,8 @@@ restart
                        continue;
                if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgroup_parent(cgrp))
                        continue;
 -
 +              if ((cft->flags & CFTYPE_DEBUG) && !cgroup_debug)
 +                      continue;
                if (is_add) {
                        ret = cgroup_add_file(css, cgrp, cft);
                        if (ret) {
@@@ -4207,20 -4202,25 +4207,25 @@@ static void css_task_iter_advance(struc
  
        lockdep_assert_held(&css_set_lock);
  repeat:
-       /*
-        * Advance iterator to find next entry.  cset->tasks is consumed
-        * first and then ->mg_tasks.  After ->mg_tasks, we move onto the
-        * next cset.
-        */
-       next = it->task_pos->next;
+       if (it->task_pos) {
+               /*
+                * Advance iterator to find next entry.  cset->tasks is
+                * consumed first and then ->mg_tasks.  After ->mg_tasks,
+                * we move onto the next cset.
+                */
+               next = it->task_pos->next;
  
-       if (next == it->tasks_head)
-               next = it->mg_tasks_head->next;
+               if (next == it->tasks_head)
+                       next = it->mg_tasks_head->next;
  
-       if (next == it->mg_tasks_head)
+               if (next == it->mg_tasks_head)
+                       css_task_iter_advance_css_set(it);
+               else
+                       it->task_pos = next;
+       } else {
+               /* called from start, proceed to the first cset */
                css_task_iter_advance_css_set(it);
-       else
-               it->task_pos = next;
+       }
  
        /* if PROCS, skip over tasks which aren't group leaders */
        if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos &&
@@@ -4260,7 -4260,7 +4265,7 @@@ void css_task_iter_start(struct cgroup_
  
        it->cset_head = it->cset_pos;
  
-       css_task_iter_advance_css_set(it);
+       css_task_iter_advance(it);
  
        spin_unlock_irq(&css_set_lock);
  }
@@@ -5748,16 -5748,6 +5753,16 @@@ static int __init cgroup_disable(char *
  }
  __setup("cgroup_disable=", cgroup_disable);
  
 +void __init __weak enable_debug_cgroup(void) { }
 +
 +static int __init enable_cgroup_debug(char *str)
 +{
 +      cgroup_debug = true;
 +      enable_debug_cgroup();
 +      return 1;
 +}
 +__setup("cgroup_debug", enable_cgroup_debug);
 +
  /**
   * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
   * @dentry: directory dentry of interest
@@@ -5993,8 -5983,10 +5998,8 @@@ static ssize_t show_delegatable_files(s
  
                ret += snprintf(buf + ret, size - ret, "%s\n", cft->name);
  
 -              if (unlikely(ret >= size)) {
 -                      WARN_ON(1);
 +              if (WARN_ON(ret >= size))
                        break;
 -              }
        }
  
        return ret;
This page took 0.082831 seconds and 4 git commands to generate.