Page MenuHomeFreeBSD

Assign map->header values to avoid boundary checks
ClosedPublic

Authored by dougm on Jan 2 2018, 6:48 AM.

Details

Summary

In several places, entry start and end field are checked, after excluding the possibility that the entry is map->header. By assigning max and min values to the start and end fields of map->header in vm_map_init, the explicit map->header checks become unnecessary.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dougm created this revision.Jan 2 2018, 6:48 AM
dougm updated this revision to Diff 37401.Jan 2 2018, 8:50 AM

Associate min_offset and max_offset with header.end and header.start, respectively.

dougm updated this revision to Diff 37437.Jan 3 2018, 2:48 AM

Eliminate unneeded &map->header checks in vm_mmap.c.

dougm added a subscriber: pho.Jan 13 2018, 4:48 AM

Peter Holm, can you please stress test this patch at your convenience?

pho added a comment.Jan 14 2018, 11:34 AM
In D13735#291224, @dougm_rice.edu wrote:

Peter Holm, can you please stress test this patch at your convenience?

I ran all of the stress2 tests. Half on amd64 and half on i386. No problems seen.

kib accepted this revision.Jan 16 2018, 11:20 AM
This revision is now accepted and ready to land.Jan 16 2018, 11:20 AM
markj accepted this revision.Jan 16 2018, 3:01 PM
markj added inline comments.
sys/vm/vm_map.c
2270 ↗(On Diff #37437)

While you're here, perhaps fix style and move the closing paren and opening brace to the end of the previous line? Ditto below.

dougm updated this revision to Diff 38043.Jan 16 2018, 6:02 PM

Make recommended formatting changes to a couple of loops.

This revision now requires review to proceed.Jan 16 2018, 6:02 PM
dougm updated this revision to Diff 38240.Jan 20 2018, 3:44 AM

Add a comment regarding the use of sentinel values.

dougm added a comment.Jan 20 2018, 3:46 AM

I have addressed the comments (made offline) from alc. He has stated that he has no objections to the resulting patch, but that I will have to rely on someone else to give it final approval and checkin. I'd appreciate that help from somebody, please.

alc accepted this revision.Jan 20 2018, 8:18 AM
This revision is now accepted and ready to land.Jan 20 2018, 8:18 AM
alc added inline comments.Jan 20 2018, 8:21 AM
sys/vm/vm_map.c
2270 ↗(On Diff #38240)

Please deindent by one space on this continuation line.

2315 ↗(On Diff #38240)

Please deindent by one space on this continuation line.

dougm updated this revision to Diff 38243.Jan 20 2018, 9:25 AM

Apply suggested changes to indentation.

This revision now requires review to proceed.Jan 20 2018, 9:25 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 20 2018, 12:19 PM
Closed by commit rS328192: Assign map->header values to avoid boundary checks. (authored by kib, committed by ). · Explain Why
This revision was automatically updated to reflect the committed changes.