I am trying to find out how can a page be determined to be "pinned" (i.e. locked in physical memory and will not be swapped out, e.g. a user program locking a piece of shared memory using shmctl with SHM_LOCK).
I found some flags in vm_area_struct(e.g. VM_LOCKED, VM_RESERVED) and in struct page(e.g. PG_locked). I wrote a kernel loadable module and tested out these flags. I expected I would see this flags set if I checked them for a page in a locked shared memory region, but they were not.
Appreciate if someone could shed some light on the proper way. Many thanks.
PS-I am running 2.6.22 kernel