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
shell: systemctl daemon-reload
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
register: config_result
- name: Install disable_thp script
copy: src=disable_thp.sh dest=/usr/local/bin/disable_thp.sh mode='u=rwx,g=rx,o=rx'
- name: Install sysfsutils package
apt: name=sysfsutils state=present
when: ansible_os_family == 'Debian' and mongodb_disable_thp
- name: Disable Linux transparent hugepages now
command: /usr/local/bin/disable_thp.sh
when: ansible_os_family == 'Debian' and mongodb_disable_thp
- name: Disable Linux transparent hugepages on boot
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'
- name: Create sysfs config
copy:
src: hugepages.conf
dest: /etc/sysfs.d/hugepages.conf
owner: root
group: root
mode: 0644
when: ansible_os_family == 'Debian' and mongodb_disable_thp
notify: restart sysfsutils
- name: get pid of mongod
command: pidof mongod