Cgroup has lots of parameters we can use to control computer resources. For CPU resources, you can tune
cpu.shares parameter to limit users’ CPU resources.
To be more precise, change directory to
/sys/fs/cgroup/cpu/user and choose the user you want to control. And then, you will see
cpu.shares parameter under the directory. You might want to read  for more details about how to tune it.