When adding swap space for paging there are options other than priority (pri=). For example discard.

However I could not find where to read back those options. /proc/swaps just has a priority column, and /proc/mounts does not list swap. swapon -s just seems to output the same information as /proc/swaps does.

So where can I get those options (without having to write a C program)?


There is no way of retrieving the swap flags which don’t feature in /proc/swaps, even by writing a C program. The only way to find out what the flags are, would be to modify the kernel.

To check this, look for users of swap_info_struct.flags. The implementation of /proc/swaps is in mm/swapfile.c.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.