Fix calculation of GFP flags

This commit is contained in:
Carsten Grohmann 2022-07-03 21:41:12 +02:00
parent be9bda6536
commit 84073ba0ce
3 changed files with 13 additions and 4 deletions

View File

@ -935,6 +935,7 @@ window.onerror = function (msg, url, lineNo, columnNo, errorObj) {
<h4>General</h4>
<ol>
<li>Fix memory calculation in summary section</li>
<li>Fix calculation of GFP flags</li>
<li>...</li>
</ol>

View File

@ -1113,7 +1113,7 @@ class OOMAnalyser:
# __pragma__ ('jsiter')
for flag in flag_definition:
value = self._flag2decimal(flag, flag_definition)
if remaining & value:
if (remaining & value) == value:
# delete flag by "and" with a reverted mask
remaining &= ~value
converted_flags.append(flag)
@ -1134,7 +1134,7 @@ class OOMAnalyser:
return value
tokenlist = iter(re.split("([|&])", value))
operator = None
operator = "|" # set to process first flag
negate_rvalue = False
lvalue = 0
while True:

12
test.py
View File

@ -189,10 +189,18 @@ class TestInBrowser(TestBase):
trigger_proc_gfp_mask = self.driver.find_element(
By.CLASS_NAME, "trigger_proc_gfp_mask"
)
# 0x201da:
# __GFP_HIGHMEM 2 0x02
# __GFP_MOVABLE 8 0x08
# __GFP_RECLAIMABLE 16 0x10
# __GFP_IO 64 0x40
# __GFP_FS 128 0x80
# __GFP_COLD 256 0x100
# __GFP_HARDWALL 131072 0x20000
# 0x201da
self.assertEqual(
trigger_proc_gfp_mask.text,
"0x201da (GFP_KERNEL | GFP_USER | GFP_HIGHUSER | "
"GFP_HIGHUSER_MOVABLE | __GFP_RECLAIMABLE | __GFP_COLD)",
"0x201da (__GFP_HIGHMEM | __GFP_MOVABLE | __GFP_RECLAIMABLE | __GFP_IO | __GFP_FS | __GFP_COLD | __GFP_HARDWALL)",
"Unexpected GFP Mask",
)