Page MenuHomeFreeBSD

vm_object: Widen the flags field
AcceptedPublic

Authored by markj on Jul 25 2022, 2:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 8:09 AM
Unknown Object (File)
Dec 20 2023, 7:14 AM
Unknown Object (File)
Dec 15 2023, 5:38 PM
Unknown Object (File)
Jul 30 2023, 4:26 PM
Unknown Object (File)
Apr 8 2023, 11:01 AM
Unknown Object (File)
Mar 22 2023, 6:33 PM
Unknown Object (File)
Jan 1 2023, 6:23 PM
Subscribers

Details

Reviewers
kib
alc
dougm
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.