Page MenuHomeFreeBSD

initializing map->header.eflags allows skipping some &map->header tests
ClosedPublic

Authored by dougm on Jan 21 2018, 7:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 4:46 AM
Unknown Object (File)
Jan 7 2024, 9:29 AM
Unknown Object (File)
Jan 7 2024, 9:29 AM
Unknown Object (File)
Jan 7 2024, 9:29 AM
Unknown Object (File)
Jan 7 2024, 9:29 AM
Unknown Object (File)
Jan 7 2024, 9:29 AM
Unknown Object (File)
Dec 22 2023, 1:24 PM
Unknown Object (File)
Dec 20 2023, 3:47 AM
Subscribers

Details

Summary

Initializing the eflags field of the map->header entry to a value with a unique new bit set makes a few comparisons to &map->header unnecessary.

Test Plan

I hope that Peter Holm will test this change and that, once it passes that test, one of the folks who approved it will check it in.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/vm/vm_map.c
799 ↗(On Diff #38271)

I think that it would be wise to define a MAP_ENTRY_HEADER flag that is only set on map header entries. Then, you could exploit the map header as a sentinel more generally. For example, vm_map_insert() and vm_map_simplify_entry() would no longer need != &map->header tests.

Set an MAP_ENTRY_HEADER bit in the eflags for the map header, and in several places, rely on eflags mismatches to replace the need for an explicit &map->header comparison check.

alc added inline comments.
sys/kern/sys_process.c
389 ↗(On Diff #49729)

I would add a comment here of the form:
/* The map header cannot have the flag MAP_ENTRY_IS_SUB_MAP set. */

sys/vm/vm_map.h
149 ↗(On Diff #49729)

The space after #define should be a tab.

Replace space with tab. Add KASSERT to ensure that map header has IS_SUB_MAP flag cleared.

sys/kern/sys_process.c
391 ↗(On Diff #49735)

Continuation lines should be indented by four spaces.

I would also suggest mentioning the use of this new flag in the comment at the top of the struct vm_map definition where we talk about min and max offset.

This revision is now accepted and ready to land.Oct 28 2018, 6:57 PM

Update and clarify a comment.

This revision now requires review to proceed.Oct 28 2018, 7:19 PM
sys/vm/vm_map.h
195–198 ↗(On Diff #49737)

I think that this comment is redundant. This information is clearly spelled out above.

dougm retitled this revision from initializing map->header.eflags allows skipping one loop test to initializing map->header.eflags allows skipping some &map->header tests.
dougm edited the summary of this revision. (Show Details)

Drop redundant comments.

This revision is now accepted and ready to land.Oct 29 2018, 6:10 PM
dougm added a reviewer: pho.
In D14005#379693, @pho wrote:

Running tests.

Anything to report?

In D14005#380591, @dougm_rice.edu wrote:
In D14005#379693, @pho wrote:

Running tests.

Anything to report?

I only used one host for the amd64 tests, so it took a while.
I ran all of the stress2 tests on amd64. I ran tests on i386 for a few hours. I did a buildworld / installworld.
No problems seen.

This revision was automatically updated to reflect the committed changes.