Assign map->header values to avoid boundary checks
ClosedPublic

Authored by dougm_rice.edu 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.
dougm_rice.edu created this revision.Jan 2 2018, 6:48 AM

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

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

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

pho added a comment.Jan 14 2018, 11:34 AM

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.

Make recommended formatting changes to a couple of loops.

This revision now requires review to proceed.Jan 16 2018, 6:02 PM

Add a comment regarding the use of sentinel values.

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.

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.