Skip to content
Snippets Groups Projects
Commit d520a948 authored by Patrick Daly's avatar Patrick Daly
Browse files

lrdpv2: Correct caching of virt->physical translations

Cache translations for pages rather than by exact address. This shows
a large improvement in efficiency for some specific cases:

Before:
[9/33] --dmesg ... 18.810140s
[23/33] --print-rtb ... 78.879237s
[26/33] --print-tasks ... 29.115214s

After:
[9/33] --dmesg ... 0.952276s
[23/33] --print-rtb ... 7.542078s
[26/33] --print-tasks ... 4.092283s

Change-Id: I1268928e2f1f0493b9047497a0f91b86ad83a296
parent b4fa595a
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
# Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 and
......@@ -51,16 +51,21 @@ class MMU(object):
if addr is None:
return None
page_addr = (addr >> 12) << 12
page_offset = addr & 0xFFF
if not skip_tlb:
if addr in self._tlb:
return self._tlb[addr]
if page_addr in self._tlb:
return self._tlb[page_addr] + page_offset
phys_addr = self.page_table_walk(addr)
phys_addr = self.page_table_walk(page_addr)
if phys_addr is None:
return None
if save_in_tlb:
self._tlb[addr] = phys_addr
self._tlb[page_addr] = phys_addr
return phys_addr
return phys_addr + page_offset
def load_page_tables(self):
raise NotImplementedError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment