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

Improve pmap protect #1420

Merged
merged 10 commits into from
Jan 18, 2024
Merged

Conversation

franciscozdo
Copy link
Collaborator

@franciscozdo franciscozdo commented Dec 18, 2023

Optimizing pmap_protect to traverse pmap structure effectively instead of looking up every pte starting from root.

The pmap_protect_walk function is called recursively at each pmap level. On the last level it modifies the protection of pte.

Below I provide some statistics about function calls created using KFT, to show that this change really matters.

Before

     function: count avg time
 vm_map_clone:   146   158477
vm_page_fault:  3910     7901
 pmap_protect:  1041    19849

After

     function: count avg time
 vm_map_clone:   146    64040
vm_page_fault:  3668     7554
 pmap_protect:  1041     6674

@franciscozdo franciscozdo added the WiP not ready for code review label Dec 18, 2023
@franciscozdo franciscozdo added review please review this PR and removed WiP not ready for code review labels Dec 19, 2023
Copy link
Owner

@cahirwpz cahirwpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nit-picks, otherwise looks good.

include/aarch64/pmap.h Outdated Show resolved Hide resolved
include/aarch64/pmap.h Outdated Show resolved Hide resolved
include/aarch64/pmap.h Outdated Show resolved Hide resolved
include/mips/pmap.h Outdated Show resolved Hide resolved
include/mips/pmap.h Outdated Show resolved Hide resolved
include/riscv/pmap.h Outdated Show resolved Hide resolved
include/riscv/pmap.h Outdated Show resolved Hide resolved
include/riscv/pmap.h Outdated Show resolved Hide resolved
include/sys/_pmap.h Show resolved Hide resolved
include/sys/_pmap.h Show resolved Hide resolved
Copy link
Owner

@cahirwpz cahirwpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cahirwpz cahirwpz merged commit 80b189b into cahirwpz:master Jan 18, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review please review this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants