lkml.org 
[lkml]   [2009]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC v2 PATCH 2/8] sched: Maintain aggregated tasks count in cfs_rq at each hierarchy level
    On Tue, Oct 13, 2009 at 04:27:01PM +0200, Peter Zijlstra wrote:
    > On Wed, 2009-09-30 at 18:21 +0530, Bharata B Rao wrote:
    >
    > > diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
    > > index 652e8bd..eeeddb8 100644
    > > --- a/kernel/sched_fair.c
    > > +++ b/kernel/sched_fair.c
    > > @@ -243,6 +243,27 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse)
    > >
    > > #endif /* CONFIG_FAIR_GROUP_SCHED */
    > >
    > > +static void add_cfs_rq_tasks_running(struct sched_entity *se,
    > > + unsigned long count)
    > > +{
    > > + struct cfs_rq *cfs_rq;
    > > +
    > > + for_each_sched_entity(se) {
    > > + cfs_rq = cfs_rq_of(se);
    > > + cfs_rq->nr_tasks_running += count;
    > > + }
    > > +}
    > > +
    > > +static void sub_cfs_rq_tasks_running(struct sched_entity *se,
    > > + unsigned long count)
    > > +{
    > > + struct cfs_rq *cfs_rq;
    > > +
    > > + for_each_sched_entity(se) {
    > > + cfs_rq = cfs_rq_of(se);
    > > + cfs_rq->nr_tasks_running -= count;
    > > + }
    > > +}
    > >
    > > /**************************************************************
    > > * Scheduling class tree data structure manipulation methods:
    > > @@ -969,6 +990,7 @@ static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
    > > wakeup = 1;
    > > }
    > >
    > > + add_cfs_rq_tasks_running(&p->se, 1);
    > > hrtick_update(rq);
    > > }
    > >
    > > @@ -991,6 +1013,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
    > > sleep = 1;
    > > }
    > >
    > > + sub_cfs_rq_tasks_running(&p->se, 1);
    > > hrtick_update(rq);
    > > }
    >
    > This seems daft, why not add the incement to the for_each_sched_entity()
    > loop already present in both functions?

    Right. There was a reason why it started out like this and I can't seem to
    remember. Now looking at the current code, I don't see why I can't do what
    you suggest. Will try this for the next post.

    Regards,
    Bharata.


    \
     
     \ /
      Last update: 2009-10-14 05:47    [W:0.026 / U:0.140 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site