How do I get rid of /sys/kernel/debug/tracing?

I have two Ubuntu 16.04.1 servers providing DHCP and DNS services on my network. Today, on one of my servers, I discovered a new filesystem mounted at /sys/kernel/debug/tracing. The other server, which is configured almost identically, does not have this filesystem mounted.

Why did this filesystem get mounted? How do I get rid of it?

> uname -a
Linux net-services-02 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

> cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-4.4.0-47-generic root=/dev/mapper/net--services--02--vg-root ro

> cat /etc/fstab
# /etc/fstab: static file system information.
# [... more comments ...]
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/net--services--02--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=363b849e-4574-410a-acf9-e84c95d7d879 /boot           ext2    defaults        0       2
/dev/mapper/net--services--02--vg-swap_1 none            swap    sw              0       0

At first I thought the problem had something to do with your Linux net-services revealed by uname -a command. I'm on Ubuntu 16.04 desktop so had little hope I could solve these two questions. I read up on the situation from this link: (redhat.com - Realtime Tuning Guide) that discusses /sys/kernel/debug/tracing/

Question 1: How did "debugfs on /sys/kernel/debug" get mounted?

Imagine my surprise learning on my system kernel tracing was also enabled:

# cat /proc/sys/kernel/ftrace_enabled
1

Also when I type mount, this is one of the lines that appears:

debugfs on /sys/kernel/debug type debugfs (rw,relatime)

I rebooted my kernel 4.4.0-47 to 4.4.0-45 then to 4.8.5 and finally to 3.13.0-92. ALL these versions have /sys/kernel/debug mounted.

To answer your question (paraphrased) "how did this happen?" -> it happens to everyone.

Question 2: How do I get rid of it?

To answer your question "how do I get rid of it?", use:

sudo umount debugfs

Note this only works for current session.

Summary Thoughts

Even though trace is enabled on all Ubuntu kernel versions I've tested, it is not activated until you tell it to start monitoring a specific event. After an event is activated then it will slow down your CPU.

Basically I would not worry about this...