summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/host/inode_refs.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fsimpl/host/inode_refs.go')
-rw-r--r--pkg/sentry/fsimpl/host/inode_refs.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/host/inode_refs.go b/pkg/sentry/fsimpl/host/inode_refs.go
index 8862c4a5e..1ca9a7868 100644
--- a/pkg/sentry/fsimpl/host/inode_refs.go
+++ b/pkg/sentry/fsimpl/host/inode_refs.go
@@ -20,6 +20,14 @@ var inodeobj *inode
// Refs implements refs.RefCounter. It keeps a reference count using atomic
// operations and calls the destructor when the count reaches zero.
//
+// NOTE: Do not introduce additional fields to the Refs struct. It is used by
+// many filesystem objects, and we want to keep it as small as possible (i.e.,
+// the same size as using an int64 directly) to avoid taking up extra cache
+// space. In general, this template should not be extended at the cost of
+// performance. If it does not offer enough flexibility for a particular object
+// (example: b/187877947), we should implement the RefCounter/CheckedObject
+// interfaces manually.
+//
// +stateify savable
type inodeRefs struct {
// refCount is composed of two fields: