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)?

1 Answer 1


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .