Page MenuHomeFreeBSD

vm_object: Widen the flags field
ClosedPublic

Authored by markj on Jul 25 2022, 2:58 PM.
Tags
None
Referenced Files
F107584493: D35905.diff
Thu, Jan 16, 6:01 AM
Unknown Object (File)
Wed, Jan 1, 4:06 PM
Unknown Object (File)
Nov 7 2024, 8:15 AM
Unknown Object (File)
Oct 7 2024, 9:33 AM
Unknown Object (File)
Oct 7 2024, 3:34 AM
Unknown Object (File)
Oct 6 2024, 1:14 PM
Unknown Object (File)
Oct 6 2024, 10:43 AM
Unknown Object (File)
Oct 6 2024, 7:36 AM
Subscribers

Details

Summary

We can reorder pg_color and flags to recover two pad bytes, and thus
avoid increasing sizeof(struct vm_object). In particular, the current
layout looks like this:

...
/* 120 | 4 */ volatile int generation;
/* 124 | 4 */ int cleangeneration;
/* 128 | 4 */ volatile u_int ref_count;
/* 132 | 4 */ int shadow_count;
/* 136 | 1 */ vm_memattr_t memattr;
/* 137 | 1 */ objtype_t type;
/* 138 | 2 */ u_short flags;
/* 140 | 2 */ u_short pg_color;
/* XXX 2-byte hole */
/* 144 | 4 */ blockcount_t paging_in_progress;
/* 148 | 4 */ blockcount_t busy;
/* 152 | 4 */ int resident_page_count;
/* XXX 4-byte hole */
/* 160 | 8 */ struct vm_object *backing_object;
/* 168 | 8 */ vm_ooffset_t backing_object_offset;
...

I believe the offset of "flags" is part of the external kernel ABI, so
this change would not be MFCed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46548
Build 43437: arc lint + arc unit

Event Timeline

markj requested review of this revision.Jul 25 2022, 2:58 PM

I do not believe that we can reasonably consider vm structures part of the KBI.

This revision is now accepted and ready to land.Jul 25 2022, 4:12 PM
In D35905#815409, @kib wrote:

I do not believe that we can reasonably consider vm structures part of the KBI.

Well, we do not have any formal definition as far as I know. Some fields for other structs have "_KBI" accessors, but not VM objects. And e.g., vm_object_set_flag() is KBI-dependent. I suspect that if I merge this change to stable branches, some popular packages will break and I'll get lots of complaints.

Please push this. I still want this in 14.

This revision was automatically updated to reflect the committed changes.
sys/vm/vm_object.h
295

Why did you dropped this chunk on commit?

295

(It was s/u_short/u_int/)

sys/vm/vm_object.h
295

Thank you, I forgot to squash a fixup commit.