Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vnode refcounting #3

Open
netbsduser opened this issue May 8, 2023 · 1 comment
Open

Vnode refcounting #3

netbsduser opened this issue May 8, 2023 · 1 comment

Comments

@netbsduser
Copy link

This has been disabled for a while because the old pathname lookup code mis-refcounted, so there are probably numerous areas that need it to be handled properly. It might also be wise to implement the VFS name cache (#15) first to delay the need to implement the actual freeing of vnodes.

The actual freeing of vnodes requires some thought to do properly:

  • the pages must all be synced to backing store first;
  • it would be inappropriate to hold a lock during that sync, so there needs to be a '2nd-chance' mechanism for vnodes in process of syncing to be re-referenced before they are purged from e.g. inode number to vnode cache;
  • tmpfs, of course, cannot free its vnodes yet because vnodes embed VM objects, a decision that was made to simplify refcounting but might be worth revisiting, as a VM object can't (?) change its backing vnode, so holding a reference to a VM object should be enough to let us lock in whatever order we wish
@netbsduser
Copy link
Author

Keyronex/Keyronex#21 has mostly fixed this. The strategy taken:

  • vnodes no longer embed VM objects
  • refcounts are 'passed through' to vnodes from VM objects, which do not themselves reference their associated vnode; EXCEPT when:
  • there are dirty pages in the VM object: every dirty page adds 1 to a count of dirty pages, and when the number rises above 0, a reference to the vnode is made, and when it falls below 0, the reference is released

Still to be done is to make sure this stuff is compatible with sockets. Those hold state in their vnode and need to preserve the vnode's existence.

@netbsduser netbsduser transferred this issue from Keyronex/Keyronex Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant