/
lib
/
python3.9
/
site-packages
/
tuned
/
plugins
/
__pycache__
/
New Directory
Upload File
HOME
a �m�jn# � @ sn d dl mZ d dlT ddlZddlZddlZddlZddlZddl m Z ej�� Z e � ZG dd� dej�ZdS )� )�base)�*� N)�commandsc @ s e Zd ZdZedd� �Zedd� �Zedd� �Zdd � Z d d� Z edd � �Zed�dd� �Z ed�dd� �Zed�dd� �Zed�dd� �Zed�dd� �Zed�dd� �Zdd� Zdd � Zd!d"� Zed#�d$d%� �Zed&�d'd(� �Zed)�d*d+� �Zed,�d-d.� �Zd/d0� Zd1S )2�VMPlugina[ Tunes selected sysctl options in `/proc/sys/vm`, currently [option]`dirty_bytes`, and [option]`dirty_background_bytes`. See https://docs.kernel.org/admin-guide/sysctl/vm.html for detailed documentation of these options. .Set dirty bytes to 64 MiB ==== ---- [vm] dirty_bytes=67108864 ---- ==== .Set dirty bytes to 10% of total available memory ==== Note that this updates the `/proc/sys/vm/dirty_ratio` sysctl option. ---- [vm] dirty_bytes=10% ---- ==== Additionally enables or disables transparent huge pages depending on the value of the [option]`transparent_hugepages` option. The option can have one of three possible values: `always`, `madvise` and `never`. .Disable transparent hugepages ==== ---- [vm] transparent_hugepages=never ---- ==== The [option]`transparent_hugepage.defrag` option specifies the defragmentation policy. Possible values for this option are `always`, `defer`, `defer+madvise`, `madvise` and `never`. For a detailed explanation of these values refer to link:https://www.kernel.org/doc/Documentation/vm/transhuge.txt[Transparent Hugepage Support]. c C s d d d d d d d d�S )N)�transparent_hugepages�transparent_hugepage�transparent_hugepage.defrag�dirty_bytes�dirty_ratio�dirty_background_bytes�dirty_background_ratio� )�selfr r �;/usr/lib/python3.9/site-packages/tuned/plugins/plugin_vm.py�_get_config_options9 s �zVMPlugin._get_config_optionsc C s2 | j | d ur.| j | d ur.t�d||f � d S )NzEConflicting options '%s' and '%s', this may cause undefined behavior.)�options�log�warning)�instance�first�secondr r r � _check_conflicting_dirty_optionsE s z)VMPlugin._check_conflicting_dirty_optionsc C s t j�d| �S )Nz/proc/sys/vm)�os�path�join)�optionr r r �_proc_sys_vm_option_pathJ s z!VMPlugin._proc_sys_vm_option_pathc C s, d|_ d|_| �|dd� | �|dd� d S )NTFr r r r )Z_has_static_tuningZ_has_dynamic_tuningr �r r r r r �_instance_initN s zVMPlugin._instance_initc C s d S �Nr r r r r �_instance_cleanupT s zVMPlugin._instance_cleanupc C s d}t j�|�sd}|S )Nz#/sys/kernel/mm/transparent_hugepagez*/sys/kernel/mm/redhat_transparent_hugepage)r r �exists)r r r r r � _thp_pathW s zVMPlugin._thp_pathr c C s� |dvr"|st �dt|� � d S tjddd�}|�d�dkrP|sLt �d� d S tj� | � � d �}tj�|�r�|s�tj|||r�t jgnd d� |S |s�t �d� d S d S )N)�always�neverZmadvisez-Incorrect 'transparent_hugepages' value '%s'.z /proc/cmdlineT�Zno_errorztransparent_hugepage=r zWtransparent_hugepage is already set in kernel boot cmdline, ignoring value from profile�enabledFzDOption 'transparent_hugepages' is not supported on current hardware.)r r �str�cmd� read_file�find�infor r r r# r"