Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove accounting change from job004007 which causes performance regression in some situations #299

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions code/locus.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,16 @@ Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass klass, Size size,
* <design/strategy#.accounting.op.fill>
*/

void PoolGenAccountForFill(PoolGen pgen, Size size)
void PoolGenAccountForFill(PoolGen pgen, Size size, Bool deferred)
{
AVERT(PoolGen, pgen);

AVER(pgen->freeSize >= size);
pgen->freeSize -= size;
pgen->bufferedSize += size;
if (deferred)
pgen->newDeferredSize += size;
else
pgen->newSize += size;
}


Expand All @@ -676,13 +679,13 @@ void PoolGenAccountForEmpty(PoolGen pgen, Size used, Size unused, Bool deferred)
{
AVERT(PoolGen, pgen);
AVERT(Bool, deferred);

UNUSED(used);

AVER(pgen->bufferedSize >= used + unused);
pgen->bufferedSize -= used + unused;
if (deferred) {
pgen->newDeferredSize += used;
pgen->newDeferredSize -= unused;
} else {
pgen->newSize += used;
pgen->newSize -= unused;
}
pgen->freeSize += unused;
}
Expand All @@ -704,15 +707,13 @@ void PoolGenAccountForAge(PoolGen pgen, Size wasBuffered, Size wasNew,
AVERT(PoolGen, pgen);
AVERT(Bool, deferred);

AVER(pgen->bufferedSize >= wasBuffered);
pgen->bufferedSize -= wasBuffered;
if (deferred) {
AVER(pgen->newDeferredSize >= wasNew);
pgen->newDeferredSize -= wasNew;
pgen->newDeferredSize -= wasNew + wasBuffered;
pgen->oldDeferredSize += wasBuffered + wasNew;
} else {
AVER(pgen->newSize >= wasNew);
pgen->newSize -= wasNew;
pgen->newSize -= wasNew + wasBuffered;
pgen->oldSize += wasBuffered + wasNew;
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/locus.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extern Res PoolGenAlloc(Seg *segReturn, PoolGen pgen, SegClass klass,
Size size, ArgList args);
extern void PoolGenFree(PoolGen pgen, Seg seg, Size freeSize, Size oldSize,
Size newSize, Bool deferred);
extern void PoolGenAccountForFill(PoolGen pgen, Size size);
extern void PoolGenAccountForFill(PoolGen pgen, Size size, Bool deferred);
extern void PoolGenAccountForEmpty(PoolGen pgen, Size used, Size unused, Bool deferred);
extern void PoolGenAccountForAge(PoolGen pgen, Size wasBuffered, Size wasNew, Bool deferred);
extern void PoolGenAccountForReclaim(PoolGen pgen, Size reclaimed, Bool deferred);
Expand Down
2 changes: 1 addition & 1 deletion code/poolamc.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn,
}
}

PoolGenAccountForFill(pgen, SegSize(seg));
PoolGenAccountForFill(pgen, SegSize(seg), MustBeA(amcSeg, seg)->deferred);
MustBeA(amcSeg, seg)->accountedAsBuffered = TRUE;

*baseReturn = base;
Expand Down
2 changes: 1 addition & 1 deletion code/poolams.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ static Bool amsSegBufferFill(Addr *baseReturn, Addr *limitReturn,
segBase = SegBase(seg);
base = PoolAddrOfIndex(segBase, pool, baseIndex);
limit = PoolAddrOfIndex(segBase, pool, limitIndex);
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit));
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit), FALSE);
DebugPoolFreeCheck(pool, base, limit);

*baseReturn = base;
Expand Down
2 changes: 1 addition & 1 deletion code/poolawl.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ static Bool awlSegBufferFill(Addr *baseReturn, Addr *limitReturn,
segBase = SegBase(seg);
base = PoolAddrOfIndex(segBase, pool, baseIndex);
limit = PoolAddrOfIndex(segBase, pool, limitIndex);
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit));
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit), FALSE);

*baseReturn = base;
*limitReturn = limit;
Expand Down
2 changes: 1 addition & 1 deletion code/poollo.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static Bool loSegBufferFill(Addr *baseReturn, Addr *limitReturn,
segBase = SegBase(seg);
base = PoolAddrOfIndex(segBase, pool, baseIndex);
limit = PoolAddrOfIndex(segBase, pool, limitIndex);
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit));
PoolGenAccountForFill(PoolSegPoolGen(pool, seg), AddrOffset(base, limit), FALSE);

*baseReturn = base;
*limitReturn = limit;
Expand Down
2 changes: 1 addition & 1 deletion code/segsmss.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static void AMSAllocateRange(AMS ams, Seg seg, Addr base, Addr limit)
AVER(amsseg->freeGrains >= allocatedGrains);
amsseg->freeGrains -= allocatedGrains;
amsseg->bufferedGrains += allocatedGrains;
PoolGenAccountForFill(ams->pgen, AddrOffset(base, limit));
PoolGenAccountForFill(ams->pgen, AddrOffset(base, limit), FALSE);
}


Expand Down
Loading