summaryrefslogtreecommitdiff
path: root/viengoos/pager.c
diff options
context:
space:
mode:
authorneal <neal>2008-02-13 14:55:57 +0000
committerneal <neal>2008-02-13 14:55:57 +0000
commit5f0f3e50ed8c0c9e1164371180ffd92a9bb35b0a (patch)
tree9bf8d351f2fd0be0ed1d34d6cb0c114df0929900 /viengoos/pager.c
parent48d948951652e893c562704c4375437e2b8ee17b (diff)
2008-02-13 Neal H. Walfield <neal@gnu.org>
* pager.c (pager_collect): If CHILD and VICTIM have the same weight steal from the activity with the larger number of pages.
Diffstat (limited to 'viengoos/pager.c')
-rw-r--r--viengoos/pager.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/viengoos/pager.c b/viengoos/pager.c
index 8bddc52..b208120 100644
--- a/viengoos/pager.c
+++ b/viengoos/pager.c
@@ -102,20 +102,35 @@ pager_collect (void)
weight += child->policy.sibling_rel.weight;
frames += child->frames_total;
- int f = child->frames_total + victim_frames;
- int w = child->policy.sibling_rel.weight + victim_policy.weight;
-
- int child_excess = child->frames_total
- - (child->policy.sibling_rel.weight * f) / w;
- int victim_excess = victim_frames
- - (victim_policy.weight * f) / w;
-
- if (child_excess > victim_excess)
- /* CHILD has more excess frames than VICTIM. */
+ if (child->policy.sibling_rel.weight == victim_policy.weight)
+ /* CHILD and VICTIM have the same weight. Prefer the
+ one with more frames. */
+ {
+ if (child->frames_total > frames)
+ {
+ victim = child;
+ victim_frames = victim->frames_total;
+ victim_policy = victim->policy.sibling_rel;
+ }
+ }
+ else
{
- victim = child;
- victim_frames = victim->frames_total;
- victim_policy = victim->policy.sibling_rel;
+ int f = child->frames_total + victim_frames;
+ int w = child->policy.sibling_rel.weight
+ + victim_policy.weight;
+
+ int child_excess = child->frames_total
+ - (child->policy.sibling_rel.weight * f) / w;
+ int victim_excess = victim_frames
+ - (victim_policy.weight * f) / w;
+
+ if (child_excess > victim_excess)
+ /* CHILD has more excess frames than VICTIM. */
+ {
+ victim = child;
+ victim_frames = victim->frames_total;
+ victim_policy = victim->policy.sibling_rel;
+ }
}
}
}));