Running Ubuntu 16.04.3 LTS with a 6GB GTX 1060 Nvidia card with 32 gigs of RAM. When I launch a game (Stellaris), I get weird mouse lag. When I leave the game, the mouse lag persists. When I reboot the machine, the mouse lag seems to end. I ma using the proprietary 384.90 Nvidia Driver.
I should also point out I am using dual monitors, in case that seems to be related. I'm guessing it is not.
This is due to the memory issue on the CPU side, you can open the system monitor to see if you have enough swap file in the resources tag, when the mouse lag happens.
Also I would suggest to use 17.10 for GTX Nvidia card, since previous I tried to use GTX with 16.04.3 and mouse/keyboard lags after the system runs for a while. Then I switch to 17.10 then everything works out fine again.
I had this problem with my Dell XPS 9560 and it was because I had disabled the crytswap in Ubuntu 17.10 in order to get the nvidia drivers working.
I have just added a normal swapfile back to the system at the same size as my RAM (16GB) and it works fine now