Updated working with transparent_hugepages

This commit is contained in:
Sergei Antipov 2015-06-16 17:33:22 +06:00
parent 46230630de
commit ae56691898
3 changed files with 13 additions and 19 deletions

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
if test -f /sys/kernel/mm/transparent_hugepage/khugepaged/defrag; then
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

View File

@ -15,3 +15,6 @@
- name: reload systemd - name: reload systemd
shell: systemctl daemon-reload shell: systemctl daemon-reload
when: systemd.stat.exists == true and mongodb_manage_service when: systemd.stat.exists == true and mongodb_manage_service
- name: restart sysfsutils
service: name=sysfsutils state=restarted

View File

@ -75,17 +75,19 @@
template: src=mongod.conf.j2 dest=/etc/mongod.conf backup=yes owner=root group=root mode=0644 template: src=mongod.conf.j2 dest=/etc/mongod.conf backup=yes owner=root group=root mode=0644
register: config_result register: config_result
- name: Install disable_thp script - name: Install sysfsutils package
copy: src=disable_thp.sh dest=/usr/local/bin/disable_thp.sh mode='u=rwx,g=rx,o=rx' apt: name=sysfsutils state=present
when: ansible_os_family == 'Debian' and mongodb_disable_thp when: ansible_os_family == 'Debian' and mongodb_disable_thp
- name: Disable Linux transparent hugepages now - name: Create sysfs config
command: /usr/local/bin/disable_thp.sh copy:
when: ansible_os_family == 'Debian' and mongodb_disable_thp src: hugepages.conf
dest: /etc/sysfs.d/hugepages.conf
- name: Disable Linux transparent hugepages on boot owner: root
lineinfile: dest=/etc/rc.local regexp='/usr/local/bin/disable_thp.sh' line='if test -f '/usr/local/bin/disable_thp.sh'; /usr/local/bin/disable_thp.sh; fi' group: root
mode: 0644
when: ansible_os_family == 'Debian' and mongodb_disable_thp when: ansible_os_family == 'Debian' and mongodb_disable_thp
notify: restart sysfsutils
- name: get pid of mongod - name: get pid of mongod
command: pidof mongod command: pidof mongod