A swap partition doesn't contain a structured filesystem. The kernel doesn't need that because it stored memory pages on the partition that's marked as swap area. Since there could be several memory pages that in the swap area, how does the kernel locate each page when a process requests its page to be loaded into memory. Let's explain more, looking at the header of the swap partition from Devuan OS:
#define SWAP_UUID_LENGTH 16
#define SWAP_LABEL_LENGTH 16
struct swap_header_v1_2 {
char bootbits[1024]; /* Space for disklabel etc. */
unsigned int version;
unsigned int last_page;
unsigned int nr_badpages;
unsigned char uuid[SWAP_UUID_LENGTH];
char volume_name[SWAP_LABEL_LENGTH];
unsigned int padding[117];
unsigned int badpages[1];
};
So when mkswap
command is executed for a parition, that's what gets placed on that partition, the swap header.
Now, let's have a scenario where process A has its memory page swapped and and so there's one memory page in the swap area. Of course, there could be many memory pages in the swap area. Now, process A needs to access that memory page that was swapped. Process A tells the kernel, may I have my swapped memory page please? The kernel says: sure my dear friend. There kernel goes looking for process A's memory page in the swap partition. Since the swap partition isn't a sophisticated structure (not a filesystem) how would the kernel know how to locate that specific memory page of process A in the swap partition.
Perhaps the kernel somewhere stores sector addresses for those swapped pages, so when a process asks for its memory page, the kernel knows where to look in the swap partition, read the memory page from the partition and loads it into memory.