Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/run-local
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ user = ENV['USER']
save_paths(result_root, user)

system 'killall', '-q', "#{LKP_SRC}/bin/event/wakeup"
system job_script, 'run_job'

with_thp_enabled { system job_script, 'run_job' }

system "#{LKP_SRC}/bin/run-with-job", job_script, "#{LKP_SRC}/bin/post-run"
system "#{LKP_SRC}/bin/event/wakeup", 'job-finished'

Expand Down
39 changes: 39 additions & 0 deletions lib/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require 'pathname'
require 'fileutils'
require 'stringio'
require 'fiddle'

require "#{LKP_SRC}/lib/array"
require "#{LKP_SRC}/lib/log"
require "#{LKP_SRC}/lib/string"
Expand Down Expand Up @@ -319,3 +321,40 @@ def with_flock(lock_file, timeout = nil)
def delete_file_if_exist(file)
File.delete(file) if File.exist?(file)
end

module THP
PR_SET_THP_DISABLE = 41
PR_GET_THP_DISABLE = 42

def self.__prctl
libc = Fiddle.dlopen(nil)
# Import the prctl function
Fiddle::Function.new(
libc['prctl'],
[Fiddle::TYPE_INT, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG, Fiddle::TYPE_LONG],
Fiddle::TYPE_INT
)
end

def self.prctl
@prctl ||= __prctl
end

def self.disable
thp_disable = prctl.call PR_GET_THP_DISABLE, 0, 0, 0, 0
return 0 if thp_disable == -1

thp_disable
end

def self.disable=(disable)
prctl.call PR_SET_THP_DISABLE, disable, 0, 0, 0
end
end

def with_thp_enabled
saved_disable = THP.disable
THP.disable = 0
yield
THP.disable = saved_disable
end
Loading