~carstengrohmann/OOMAnalyser

84073ba0ce300a633bb5345ce41209f209354b37 — Carsten Grohmann 5 months ago be9bda6
Fix calculation of GFP flags
3 files changed, 13 insertions(+), 4 deletions(-)

M OOMAnalyser.html
M OOMAnalyser.py
M test.py
M OOMAnalyser.html => OOMAnalyser.html +1 -0
@@ 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>


M OOMAnalyser.py => OOMAnalyser.py +2 -2
@@ 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:

M test.py => test.py +10 -2
@@ 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",
        )