From 84073ba0ce300a633bb5345ce41209f209354b37 Mon Sep 17 00:00:00 2001 From: Carsten Grohmann Date: Sun, 3 Jul 2022 21:41:12 +0200 Subject: [PATCH] Fix calculation of GFP flags --- OOMAnalyser.html | 1 + OOMAnalyser.py | 4 ++-- test.py | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/OOMAnalyser.html b/OOMAnalyser.html index 35cb149..3b05547 100644 --- a/OOMAnalyser.html +++ b/OOMAnalyser.html @@ -935,6 +935,7 @@ window.onerror = function (msg, url, lineNo, columnNo, errorObj) {

General

  1. Fix memory calculation in summary section
  2. +
  3. Fix calculation of GFP flags
  4. ...
diff --git a/OOMAnalyser.py b/OOMAnalyser.py index f980242..0b51663 100644 --- a/OOMAnalyser.py +++ b/OOMAnalyser.py @@ -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: diff --git a/test.py b/test.py index 3c595e3..30d1667 100755 --- a/test.py +++ b/test.py @@ -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", )