In few of the posts I read that pinning all the memory is not a good idea since some memory should be left for kernel region and running other apps.
In HPC, running an application under SLURM, it is okay to page lock all the host memory allocated by SLURM for my application. Apart from cost of page lock memory (v/s simpler malloc), is there any hidden cost.
Usually the Linux system would not even allow you to pagelock more memory than it can safely handle (assuming default settings)
cudaMallocHost or cudaHostAlloc calls will simply fail with very undescriptive error codes (e.g. 30, “unknown error”) when this condition occurs. You could fall back to regular malloc() calls when encountering an error. Logging the errors may be helpful for diagnosing if you ran into such problems.
If you ask “is it okay to page lock all the host memory allocated by SLURM for my application” I guess the critical part is: how much host memory does your application require?