'How to monitor threads' memory usage in Linux kernel?

For a scheduling requirement, I need to measure the memory bandwidth that each process/thread is utilizing in the Linux kernel.

Is there such a feature already implemented in the kernel? If not, I appreciate any solution on how may I monitor this bandwidth usage (per thread/process) in the kernel?

Please note that I need to monitor this in kernel space, not user space.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source