Extract free memory of each node from buddy info
This commit is contained in:
parent
48cc058df1
commit
fd3acbb16d
@ -2700,7 +2700,7 @@ class OOMAnalyser:
|
|||||||
"""RE to match the OOM line with kernel version"""
|
"""RE to match the OOM line with kernel version"""
|
||||||
|
|
||||||
REC_FREE_MEMORY_CHUNKS = re.compile(
|
REC_FREE_MEMORY_CHUNKS = re.compile(
|
||||||
"Node (?P<node>\d+) (?P<zone>DMA|DMA32|Normal): (?P<zone_usage>.*) = \d+kB"
|
"Node (?P<node>\d+) (?P<zone>DMA|DMA32|Normal): (?P<zone_usage>.*) = (?P<total_free_kb_per_node>\d+)kB"
|
||||||
)
|
)
|
||||||
"""RE to extract free memory chunks in a zone"""
|
"""RE to extract free memory chunks in a zone"""
|
||||||
|
|
||||||
@ -2938,7 +2938,8 @@ class OOMAnalyser:
|
|||||||
mm/page_alloc.c:show_migration_types().
|
mm/page_alloc.c:show_migration_types().
|
||||||
|
|
||||||
This function fills:
|
This function fills:
|
||||||
* OOMResult.details["_buddyinfo"] with [<node>][<zone>][<order>] = <number of free chunks>
|
* OOMResult.details["_buddyinfo"] with [<zone>][<order>][<node>] = <number of free chunks>
|
||||||
|
* OOMResult.details["_buddyinfo"] with [zone]["total_free_kb_per_node"][node] = int(total_free_kb_per_node)
|
||||||
* OOMResult.details["_buddyinfo_pagesize_kb"] with the extracted page size
|
* OOMResult.details["_buddyinfo_pagesize_kb"] with the extracted page size
|
||||||
"""
|
"""
|
||||||
self.oom_result.details["_buddyinfo"] = {}
|
self.oom_result.details["_buddyinfo"] = {}
|
||||||
@ -2961,23 +2962,29 @@ class OOMAnalyser:
|
|||||||
|
|
||||||
if zone not in buddy_info:
|
if zone not in buddy_info:
|
||||||
buddy_info[zone] = {}
|
buddy_info[zone] = {}
|
||||||
zone_details = buddy_info[zone]
|
|
||||||
|
if "total_free_kb_per_node" not in buddy_info[zone]:
|
||||||
|
buddy_info[zone]["total_free_kb_per_node"] = {}
|
||||||
|
buddy_info[zone]["total_free_kb_per_node"][node] = int(
|
||||||
|
int(match.group("total_free_kb_per_node"))
|
||||||
|
)
|
||||||
|
|
||||||
order = -1 # to start with 0 after the first increment in for loop
|
order = -1 # to start with 0 after the first increment in for loop
|
||||||
for element in match.group("zone_usage").split(" "):
|
for element in match.group("zone_usage").split(" "):
|
||||||
if element.startswith("("): # skip migration types
|
if element.startswith("("): # skip migration types
|
||||||
continue
|
continue
|
||||||
order += 1
|
order += 1
|
||||||
if order not in zone_details:
|
if order not in buddy_info[zone]:
|
||||||
zone_details[order] = {}
|
buddy_info[zone][order] = {}
|
||||||
order_details = zone_details[order]
|
|
||||||
count = element.split("*")[0]
|
count = element.split("*")[0]
|
||||||
count.strip()
|
count.strip()
|
||||||
|
|
||||||
order_details[node] = int(count)
|
buddy_info[zone][order][node] = int(count)
|
||||||
if "_total" not in order_details:
|
if "free_chunks_total" not in buddy_info[zone][order]:
|
||||||
order_details["_total"] = 0
|
buddy_info[zone][order]["free_chunks_total"] = 0
|
||||||
order_details["_total"] += order_details[node]
|
buddy_info[zone][order]["free_chunks_total"] += buddy_info[zone][order][
|
||||||
|
node
|
||||||
|
]
|
||||||
|
|
||||||
if not self.oom_result.details["_buddyinfo_pagesize_kb"] and order == 0:
|
if not self.oom_result.details["_buddyinfo_pagesize_kb"] and order == 0:
|
||||||
size = element.split("*")[1]
|
size = element.split("*")[1]
|
||||||
|
20
test.py
20
test.py
@ -871,28 +871,28 @@ Hardware name: HP ProLiant DL385 G7, BIOS A18 12/08/2012
|
|||||||
for zone, order, node, except_count in [
|
for zone, order, node, except_count in [
|
||||||
("Normal", 6, 0, 0), # order 6 - page size 256kB
|
("Normal", 6, 0, 0), # order 6 - page size 256kB
|
||||||
("Normal", 6, 1, 2), # order 6 - page size 256kB
|
("Normal", 6, 1, 2), # order 6 - page size 256kB
|
||||||
("Normal", 6, "_total", 0 + 2), # order 6 - page size 256kB
|
("Normal", 6, "free_chunks_total", 0 + 2), # order 6 - page size 256kB
|
||||||
("Normal", 0, 0, 1231), # order 0 - page size 4kB
|
("Normal", 0, 0, 1231), # order 0 - page size 4kB
|
||||||
("Normal", 0, 1, 2245), # order 0 - page size 4kB
|
("Normal", 0, 1, 2245), # order 0 - page size 4kB
|
||||||
("Normal", 0, "_total", 1231 + 2245), # order 0 - page size 4kB
|
("Normal", 0, "free_chunks_total", 1231 + 2245), # order 0 - page size 4kB
|
||||||
("DMA", 5, 0, 1), # order 5 - page size 128kB
|
("DMA", 5, 0, 1), # order 5 - page size 128kB
|
||||||
("DMA", 5, "_total", 1), # order 5 - page size 128kB
|
("DMA", 5, "free_chunks_total", 1), # order 5 - page size 128kB
|
||||||
("DMA32", 4, 0, 157), # order 4 - page size 64k
|
("DMA32", 4, 0, 157), # order 4 - page size 64k
|
||||||
("DMA32", 4, "_total", 157), # order 4 - page size 64k
|
("DMA32", 4, "free_chunks_total", 157), # order 4 - page size 64k
|
||||||
|
("Normal", "total_free_kb_per_node", 0, 38260),
|
||||||
|
("Normal", "total_free_kb_per_node", 1, 50836),
|
||||||
]:
|
]:
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
zone in buddyinfo, "Missing details for zone %s in buddy info" % zone
|
zone in buddyinfo, "Missing details for zone %s in buddy info" % zone
|
||||||
)
|
)
|
||||||
zone_info = buddyinfo[zone]
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
order in zone_info,
|
order in buddyinfo[zone],
|
||||||
'Missing details for order "%d" in buddy info' % order,
|
'Missing details for order "%s" in buddy info' % order,
|
||||||
)
|
)
|
||||||
order_info = zone_info[order]
|
count = buddyinfo[zone][order][node]
|
||||||
count = order_info[node]
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
count == except_count,
|
count == except_count,
|
||||||
'Wrong chunk count for order %d in zone "%s" for node "%s" (got: %d, expect %d)'
|
'Wrong chunk count for order %s in zone "%s" for node "%s" (got: %d, expect %d)'
|
||||||
% (order, zone, node, count, except_count),
|
% (order, zone, node, count, except_count),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user