lkml.org 
[lkml]   [2011]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [PATCH v2 12/14] Keep number of running processes per-cgroup
    From
    > This relies on the fact that the scheduler classes keep the number
    > of running processes internally in their entities.
    >
    > Signed-off-by: Glauber Costa <glommer@parallels.com>
    > ---
    ....

    > +#ifdef CONFIG_CGROUP_SCHED
    > +               /* root task group has autogrouping, so this doesn't hold */
    > +               if  (tg != &root_task_group) {
    > +#ifdef CONFIG_FAIR_GROUP_SCHED
    > +                       tg_nr_running += cpu_rq(i)->cfs.nr_running;

    I think you want to say tg->cfs_rq[i]->nr_running, otherwise it will
    show nr_running for root_task_group.

    # mount -t cgroup -o cpu xxx /mnt/
    # echo $$ > /mnt/1/tasks
    # while :; do :; done &
    [1] 1679
    # while :; do :; done &
    [2] 1682
    # while :; do :; done &
    [3] 1684
    # while :; do :; done &
    [4] 1686
    # while :; do :; done &
    [5] 1688
    # cat /mnt/1/cpu.proc.stat | grep procs_running
    procs_running 2

    > +#endif
    > +#ifdef CONFIG_RT_GROUP_SCHED
    > +                       tg_nr_running += cpu_rq(i)->rt.rt_nr_running;
    > +#endif
    > +               } else
    > +#endif
    > +                       tg_nr_running += cpu_rq(i)->nr_running;
    >
    >                for (j = 0; j < NR_SOFTIRQS; j++) {
    >                        unsigned int softirq_stat = kstat_softirqs_cpu(j, i);
    > @@ -9911,7 +9924,7 @@ int cpu_cgroup_proc_stat(struct cgroup *cgrp, struct cftype *cft,
    >                tg_nr_switches,
    >                (unsigned long)jif,
    >                total_forks,
    > -               nr_running(),
    > +               tg_nr_running,
    >                tg_iowait),
    >
    >        seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq);
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-11-14 15:45    [W:0.024 / U:181.780 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site