mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-17 08:34:23 -04:00
kern: use optimized red black tree finds for remaining holdouts
This commit is contained in:
parent
436613401a
commit
89926f44c6
5 changed files with 36 additions and 37 deletions
|
@ -705,10 +705,10 @@ namespace ams::kern {
|
|||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Try to find the page in the partially used list. */
|
||||
auto it = m_partially_used_tlp_tree.find(KThreadLocalPage(util::AlignDown(GetInteger(addr), PageSize)));
|
||||
auto it = m_partially_used_tlp_tree.find_key(util::AlignDown(GetInteger(addr), PageSize));
|
||||
if (it == m_partially_used_tlp_tree.end()) {
|
||||
/* If we don't find it, it has to be in the fully used list. */
|
||||
it = m_fully_used_tlp_tree.find(KThreadLocalPage(util::AlignDown(GetInteger(addr), PageSize)));
|
||||
it = m_fully_used_tlp_tree.find_key(util::AlignDown(GetInteger(addr), PageSize));
|
||||
R_UNLESS(it != m_fully_used_tlp_tree.end(), svc::ResultInvalidAddress());
|
||||
|
||||
/* Release the region. */
|
||||
|
@ -749,9 +749,9 @@ namespace ams::kern {
|
|||
KThreadLocalPage *tlp = nullptr;
|
||||
{
|
||||
KScopedSchedulerLock sl;
|
||||
if (auto it = m_partially_used_tlp_tree.find(KThreadLocalPage(util::AlignDown(GetInteger(addr), PageSize))); it != m_partially_used_tlp_tree.end()) {
|
||||
if (auto it = m_partially_used_tlp_tree.find_key(util::AlignDown(GetInteger(addr), PageSize)); it != m_partially_used_tlp_tree.end()) {
|
||||
tlp = std::addressof(*it);
|
||||
} else if (auto it = m_fully_used_tlp_tree.find(KThreadLocalPage(util::AlignDown(GetInteger(addr), PageSize))); it != m_fully_used_tlp_tree.end()) {
|
||||
} else if (auto it = m_fully_used_tlp_tree.find_key(util::AlignDown(GetInteger(addr), PageSize)); it != m_fully_used_tlp_tree.end()) {
|
||||
tlp = std::addressof(*it);
|
||||
} else {
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue