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

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

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?

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.

This revision is now accepted and ready to land.Jan 16 2018, 11:20 AM
markj added inline comments.
sys/vm/vm_map.c
2270

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.

This revision is now accepted and ready to land.Jan 20 2018, 8:18 AM
sys/vm/vm_map.c
2270

Please deindent by one space on this continuation line.

2315

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
This revision was automatically updated to reflect the committed changes.