transparent_hugepage sysfs settings

Module for parsing the sysfs settings for transparent_hugepage:

ThpUseZeroPage - file /sys/kernel/mm/transparent_hugepage/use_zero_page

ThpEnabled - file /sys/kernel/mm/transparent_hugepage/enabled

ThpShmemEnabled - file /sys/kernel/mm/transparent_hugepage/shmem_enabled

class insights.parsers.transparent_hugepage.ThpEnabled(context)[source]

Bases: Parser

Gets the contents of /sys/kernel/mm/transparent_hugepage/enabled, which is something like always [madvise] never where the active value is in brackets. If no option is active (that should never happen), active_option will contain None.

line

Contents of the input file.

Type:

str

active_option

The active option for transparent huge pages, or None if not present.

Type:

str

Sample input:

always [madvise] never

Examples

>>> type(thp_enabled)
<class 'insights.parsers.transparent_hugepage.ThpEnabled'>
>>> thp_enabled.line
'always [madvise] never'
>>> thp_enabled.active_option
'madvise'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.transparent_hugepage.ThpShmemEnabled(context)[source]

Bases: Parser

Class for parsing the /sys/kernel/mm/transparent_hugepage/shmem_enabled files..

line

Contents of the input file.

Type:

str

active_option

The active option for shmem_enabled of transparent huge pages, or None if not present.

Type:

str

Typical content of the file is:

always within_size advise [never] deny force

Examples

>>> type(thp_shmem_enabled)
<class 'insights.parsers.transparent_hugepage.ThpShmemEnabled'>
>>> thp_shmem_enabled.line
'always within_size advise [never] deny force'
>>> thp_shmem_enabled.active_option
'never'
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.transparent_hugepage.ThpUseZeroPage(context)[source]

Bases: Parser

Gets the contents of /sys/kernel/mm/transparent_hugepage/use_zero_page, which is either 0 or 1.

use_zero_page

The setting, should be 0 or 1.

Type:

str

Sample input:

0

Examples

>>> type(thp_use_zero_page)
<class 'insights.parsers.transparent_hugepage.ThpUseZeroPage'>
>>> thp_use_zero_page.use_zero_page
'0'
parse_content(content)[source]

This method must be implemented by classes based on this class.