Mmmemoryc

static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, int write_access, pte_t orig_pte) {

grab_swap_token(); /* Contend for token _before_ read-in */ /* Read the page in */

put_swap_token must be employed to release the swap token for the current process when the mm_struct of the current swap token is not required anymore. disable_token takes the token away forcefully. This is necessary when swapping out is really necessary, and you will encounter the corresponding cases below.

The key to the swap token implementation lies in the places where the kernel checks if the current process is the owner of the swap token, and the consequences for the process if it has the swap token. has_swap_token tests if a process has the swap token. The check is, however, only performed at a single place in the kernel: when it checks if a page has been referenced (recall that this is one of the essential ingredients to decide if a page is going to be reclaimed, and that page_referenced_one is a subfunction of page_referenced, which is only called from there):

Continue reading here: Mmrmapc

Was this article helpful?

0 0