Lines Matching +full:4 +full:kb +full:- +full:page

2 # SPDX-License-Identifier: GPL-2.0-only
5 # Utility providing smaps-like output detailing transparent hugepage usage.
7 # ./thpmaps --help
34 return (v + (a - 1)) & ~(a - 1)
38 return v & (a - 1)
41 def kbnr(kb):
42 # Convert KB to number of pages.
43 return (kb << 10) >> PAGE_SHIFT
47 # Convert number of pages to KB.
52 # Convert page order to KB.
65 r[1:] -= d
66 r[:-1] -= d
67 return [np.repeat(arr, r).reshape(-1, 2) for arr in index]
129 PM_PFN_MASK = (1 << 55) - 1
202 if '-' in elements[0]:
203 start, end = map(lambda x: int(x, 16), elements[0].split('-'))
216 inode=int(elements[4], 16),
220 param = elements[0][:-1]
223 self.vmas[-1].stats[param] = {'type': None, 'value': value}
230 # Given 4 same-sized arrays representing a range within a page table backed
232 # True if page is anonymous, heads: True if page is head of a THP), return a
255 # the first page of the range is a tail.
256 nr = (int(folios[0]) if len(folios) else index_end) - index_next
260 # the next page after the range is a tail.
264 nr = index_end - int(folios[-1])
265 folios = folios[:-1]
266 index_end -= nr
267 stats['anon' if anons[index_end - 1] else 'file']['partial'] += nr
271 folio_nrs = np.append(np.diff(folios), np.uint64(index_end - folios[-1]))
282 # Account PMD-mapped THPs spearately, so filter out of the stats. There is a
288 …stats['anon']['aligned'][PMD_ORDER] = max(0, stats['anon']['aligned'][PMD_ORDER] - kbnr(anon_pmd_m…
289 …stats['file']['aligned'][PMD_ORDER] = max(0, stats['file']['aligned'][PMD_ORDER] - kbnr(file_pmd_m…
292 f"anon-thp-pmd-aligned-{odkb(PMD_ORDER)}kB": {'type': 'anon', 'value': anon_pmd_mapped},
293 f"file-thp-pmd-aligned-{odkb(PMD_ORDER)}kB": {'type': 'file', 'value': file_pmd_mapped},
297 param = f"{type}-thp-pte-{subtype}-{{}}kB"
304 rstats[f"{type}-thp-pte-partial"] = {'type': type, 'value': nrkb(stats['partial'])}
313 # Given 4 same-sized arrays representing a range within a page table backed
315 # True if page is anonymous, heads: True if page is head of a THP), return a
330 off = align_forward(vfn_start, nr_cont) - vfn_start
342 # Account blocks that are PMD-mapped spearately, so filter out of the stats.
349 nr_anon = max(0, nr_anon - kbnr(anon_pmd_mapped))
350 nr_file = max(0, nr_file - kbnr(file_pmd_mapped))
353 f"anon-cont-pmd-aligned-{nrkb(nr_cont)}kB": {'type': 'anon', 'value': anon_pmd_mapped},
354 f"file-cont-pmd-aligned-{nrkb(nr_cont)}kB": {'type': 'file', 'value': file_pmd_mapped},
357 rstats[f"anon-cont-pte-aligned-{nrkb(nr_cont)}kB"] = {'type': 'anon', 'value': nrkb(nr_anon)}
358 rstats[f"file-cont-pte-aligned-{nrkb(nr_cont)}kB"] = {'type': 'file', 'value': nrkb(nr_file)}
366 print("{:010d}: {:016x}-{:016x} {}{}{}{} {:08x} {:02x}:{:02x} {:08x} {}"
369 'r' if vma.read else '-', 'w' if vma.write else '-',
370 'x' if vma.execute else '-', 'p' if vma.private else 's',
382 pad = max(0, label_field - len(label) - 1)
389 print(f"{label}:{' ' * pad}{value:8} kB{percent}")
397 pmes = pagemap.get(start, end - start)
422 tot_file = vma.stats['Rss']['value'] - tot_anon
490 docs_width -= 2
509 if human[-1] in units:
510 unit = units[human[-1]]
511 human = human[:-1]
515 raise ArgException('error: --cont value must be integer size with optional KMG unit')
519 raise ArgException('error: --cont value must be size of at least 2 pages')
521 raise ArgException('error: --cont value must be size of power-of-2 pages')
523 raise ArgException('error: --cont value must be less than or equal to PMD order')
528 pages are mapped, either system-wide, or for a specified
531 When run with --pid, the user explicitly specifies the set
532 of pids to scan. e.g. "--pid 10 [--pid 134 ...]". When run
533 with --cgroup, the user passes either a v1 or v2 cgroup and
535 run with neither --pid nor --cgroup, the full set of pids on
537 had provided "--pid 1 --pid 2 ...".\\n
542 the block size is user-defined.\\n
545 file-backed (pagecache) memory and are shown both in kB and
547 file-backed memory as appropriate.\\n
550 --------------\\n
552 Statistics are always generated for fully- and
553 contiguously-mapped THPs whose mapping address is aligned to
557 PMD if it is PMD-sized):\\n
559 - anon-thp-pte-aligned-<size>kB\\n
560 - file-thp-pte-aligned-<size>kB\\n
561 - anon-thp-pmd-aligned-<size>kB\\n
562 - file-thp-pmd-aligned-<size>kB\\n
564 Similarly, statistics are always generated for fully- and
565 contiguously-mapped THPs whose mapping address is *not*
570 - anon-thp-pte-unaligned-<size>kB\\n
571 - file-thp-pte-unaligned-<size>kB\\n
574 belong to a THP but where the is THP is *not* fully- and
575 contiguously- mapped. These "partial" mappings are all
579 - anon-thp-pte-partial\\n
580 - file-thp-pte-partial\\n
583 ---------------------------\\n
586 every contiguous block size specified with `--cont <size>`.
594 - anon-cont-pte-aligned-<size>kB\\n
595 - file-cont-pte-aligned-<size>kB\\n
596 - anon-cont-pmd-aligned-<size>kB\\n
597 - file-cont-pmd-aligned-<size>kB\\n
599 As an example, if monitoring 64K contiguous blocks (--cont
601 blocks: a fully- and contiguously-mapped 64K THP that is
602 aligned to a 64K boundary would provide 1 block. A fully-
603 and contiguously-mapped 128K THP that is aligned to at least
606 boundary would provide 1 block. A fully- and
607 contiguously-mapped 2M THP would provide 32 blocks. There
613 group.add_argument('--pid',
616 scan multiple processes. --pid and --cgroup are mutually exclusive.
618 system-wide information.""")
620 group.add_argument('--cgroup',
623 the cgroup and its children. --pid and --cgroup are mutually
625 provide system-wide information.""")
627 parser.add_argument('--rollup',
629 help="""Sum the per-vma statistics to provide a summary over the whole
632 parser.add_argument('--cont',
637 hpa mappings. Size must be a power-of-2 number of pages.""")
639 parser.add_argument('--inc-smaps',
644 parser.add_argument('--inc-empty',
648 parser.add_argument('--periodic',