Page MenuHomeFreeBSD

vnode_pager: clean up undirty_pages()
ClosedPublic

Authored by dougm on Tue, Dec 23, 5:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 27, 10:49 AM
Unknown Object (File)
Sat, Dec 27, 10:46 AM
Unknown Object (File)
Sat, Dec 27, 8:18 AM
Unknown Object (File)
Fri, Dec 26, 5:56 PM
Unknown Object (File)
Fri, Dec 26, 5:56 PM
Unknown Object (File)
Fri, Dec 26, 2:25 AM
Unknown Object (File)
Fri, Dec 26, 2:25 AM
Unknown Object (File)
Thu, Dec 25, 10:40 PM
Subscribers

Details

Summary

The first (second) loop of vnode_pager_undirty_pages() includes an if-test to test whether an iteration is the last (first). Move those if-tests out of their loops.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Tue, Dec 23, 5:18 PM
dougm created this revision.
sys/vm/vnode_pager.c
1529

I don't like that the same parameter (written, lpos) sometimes represents a quantity measured in bytes and other times pages. Adding a variable to represent page counts would better.

dougm marked an inline comment as done.

Add npages variable.

sys/vm/vnode_pager.c
1543

I suggest adding some comment after this point.

In the previous organization of the function, it was more or less clear that we process two runs of the pages: first run from the start to the written position, and the second run from eof to the end. Now it is less clear IMO. Explaining this would be beneficial to the reader.

In this place, it is useful to note that we skip touching pages between round_page(written) and trunc_page(eof).

Add comments preceding each block of code that processes a range of consecutive pages. Reformat comment blocks.

sys/vm/vnode_pager.c
1541–1552
dougm marked 2 inline comments as done.

Fix comment typo.

This revision is now accepted and ready to land.Thu, Dec 25, 6:25 PM

The changes here have led the compiler to unroll the first and final loops, making the machine code larger.

sys/vm/vnode_pager.c
1564

I would delete this blank line so that the final loop is not disconnected from the block that begins with the comment describing it.

This revision now requires review to proceed.Fri, Dec 26, 8:36 PM
This revision is now accepted and ready to land.Fri, Dec 26, 8:48 PM
This revision was automatically updated to reflect the committed changes.