Improve detection perf_swevent_enabled and ptmx_fops