Skip to content

Commit

Permalink
[PATCH] rcu: keep rcu callback event counter
Browse files Browse the repository at this point in the history
This makes call_rcu() keep track of how many events there are on the RCU
list, and cause a reschedule event when the list gets too long.

This helps keep RCU event lists down.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed Oct 17, 2005
1 parent cc67523 commit 5ee832d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct rcu_data {
long batch; /* Batch # for current RCU batch */
struct rcu_head *nxtlist;
struct rcu_head **nxttail;
long count; /* # of queued items */
struct rcu_head *curlist;
struct rcu_head **curtail;
struct rcu_head *donelist;
Expand Down
11 changes: 11 additions & 0 deletions kernel/rcupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ void fastcall call_rcu(struct rcu_head *head,
rdp = &__get_cpu_var(rcu_data);
*rdp->nxttail = head;
rdp->nxttail = &head->next;

if (unlikely(++rdp->count > 10000))
set_need_resched();

local_irq_restore(flags);
}

Expand Down Expand Up @@ -140,6 +144,12 @@ void fastcall call_rcu_bh(struct rcu_head *head,
rdp = &__get_cpu_var(rcu_bh_data);
*rdp->nxttail = head;
rdp->nxttail = &head->next;
rdp->count++;
/*
* Should we directly call rcu_do_batch() here ?
* if (unlikely(rdp->count > 10000))
* rcu_do_batch(rdp);
*/
local_irq_restore(flags);
}

Expand All @@ -157,6 +167,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
next = rdp->donelist = list->next;
list->func(list);
list = next;
rdp->count--;
if (++count >= maxbatch)
break;
}
Expand Down

0 comments on commit 5ee832d

Please sign in to comment.