-
Notifications
You must be signed in to change notification settings - Fork 8.3k
demand_paging: eviction: add kconfig CONFIG_EVICTION_TRACKING #81365
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
demand_paging: eviction: add kconfig CONFIG_EVICTION_TRACKING #81365
Conversation
npitre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for the Kconfig symbol, however it might be nicer to define
empty static inline stubs when disabled rather than adding more #ifdef
in kernel/mmu.c.
|
Being |
|
Being `static inline` does not necessarily eliminate the related code when no optimization is used.
Then why would you even care?
Code readability is more important than optimizing the "no optimization" case.
|
|
Because lots of time I do debug with no optimizations. |
|
Because lots of time I do debug with no optimizations.
Then you must be used to skip over all those empty inline stubs already.
|
peter-mitsis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with the #ifdef stuff, but if it is blocking issue, would defining the affected routines as empty macros be a satisfactory compromise? It is an approach with precedence and should hopefully work well with the no optimization scenario.
Well... doesn't mean that I want to make it worse. Besides, there is now code being run which should not have been there, for example the for loop in |
This adds a new kconfig for eviction algorithm which needs page tracking. When enabled, k_mem_paging_eviction_add()/_remove() and k_mem_paging_eviction_accessed() must be implemented. If an algorithm does not do page tracking, there is no need to implement these functions, and no need for the kernel MMU code to call into empty functions. This should save a few function calls and some CPU cycles. Note that arm64 unconditionally calls those functions so forces CONFIG_EVICTION_TRACKING to be enabled there. Signed-off-by: Daniel Leung <[email protected]>
845ea74 to
436c7bb
Compare
|
I guess a comprise can be done via |
This adds a new kconfig for eviction algorithm which needs page tracking. When enabled, k_mem_paging_eviction_add()/_remove() and k_mem_paging_eviction_accessed() must be implemented. If an algorithm does not do page tracking, there is no need to implement these functions, and no need for the kernel MMU code to call into empty functions. This should save a few function calls and some CPU cycles.
Note that arm64 unconditionally calls those functions so forces CONFIG_EVICTION_TRACKING to be enabled there.