Using nvidia-smi --gpu-reset will reset the GPU and free any allocated resources, including memory, held by the defunct process. However, this command can only be used when the GPU is idle, meaning no other active processes are using the GPU.
If your GPU is being used by other active processes, the --gpu-reset command might fail or cause unintended side effects, such as terminating those processes or causing them to malfunction due to the sudden loss of GPU resources.
Since the defunct process's parent is PID=1, it is unlikely that it will generate any further trouble. When you reset the GPU, the resources it has allocated will be released, and the defunct process won't be able to see or use them.
It is generally safe to use nvidia-smi --gpu-reset as long as there are no other processes actively using the GPU. If there are other processes using the GPU, you should try to gracefully stop those processes before resetting the GPU. Additionally, it is a good idea to monitor your system after resetting the GPU to ensure that no unexpected issues arise.
It's quite common that you need to restart machine if gets frozen, as probably kernel module gets stuck and it doesn't respond even to killing processes that are using GPU