Hello Dan Burkert, Adar Dembo,

I'd like you to do a code review. Please visit

    http://gerrit.cloudera.org:8080/9676

to review the following change.


Change subject: KUDU-1447. Automatically disable THP on process heap
......................................................................

KUDU-1447. Automatically disable THP on process heap

Per KUDU-1447, we have long seen issues with process stalls when
transparent huge pages are enabled on the system. Though we've tried to
encourage people to disable it, especially on old kernels like el6, it's
hard to enforce that.

This patch applies one of the suggestions from the discussion on that
JIRA. It hooks tcmalloc so that whenever tcmalloc allocates new memory
from the system, we call madvise(MADV_NOHUGEPAGE) on it. This
unregisters the memory region from khugepaged's list of pages to scan,
and also ensures that we don't try to synchronously allocate a huge page
when we first touch the memory.

It's hard to add an automated test, but I started a tserver and then
looked at the 'VmFlags' line in /proc/<pid>/smaps for the heap VM area.
When running with --disable_hugepages=always, I saw the 'nh'
(nohugepages) flag indicated on the heap. Without the command line, it
did not have that flag.

Note that this only affects heaps and not other items like the code
mappings themselves or the thread stacks. The heap should cover the
majority of the memory, and thus reduce the impact of these THP issues.

The default value for the new flag is "auto" which looks at the kernel
version to determine whether THP is problematic. Based on my research
(described in a comment in the code) it seems kernel 4.6 and later are
not susceptible to THP-related stalls.

Change-Id: I4e356466f0473546d52763123e7948f2e8756ceb
---
M src/kudu/master/master_main.cc
M src/kudu/tserver/tablet_server_main.cc
M src/kudu/util/process_memory.cc
M src/kudu/util/process_memory.h
4 files changed, 166 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/76/9676/1
--
To view, visit http://gerrit.cloudera.org:8080/9676
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e356466f0473546d52763123e7948f2e8756ceb
Gerrit-Change-Number: 9676
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Dan Burkert <[email protected]>

Reply via email to