How do we check the "locked" shared memory of a process in linux?
You should use the ipcs(1) command, as:
ipcs | grep locked
The ipcs command show the 'locked' status on the 'status' field, as shown by the ipcs.c code:
printf (" %-10ju %-6s %-6s\n", shmdsp->shm_nattch, shmdsp->shm_perm.mode & SHM_DEST ? _("dest") : " ", shmdsp->shm_perm.mode & SHM_LOCKED ? _("locked") : " ");