Why I don't have pages that do not contain pages when swap is disabled
I go through the vm_area_struct scopes of the task and try to get the corresponding page of the page (page) structure, but some pages are missing from RAM: pte_present (* pte) returns 0. I can't figure out this behavior because I have no swap space, so I suppose that all user-space virtual space is mapped to the rendered pages in RAM. Can anyone explain this to me?
static struct page * get_page(unsigned long addr)
{
pgd_t *pgd;
pte_t *pte;
pud_t *pud;
pmd_t *pmd;
struct page *pg;
struct mm_struct *mm = current->mm;
pgd = pgd_offset(mm, addr);
if (pgd_none_or_clear_bad(pgd)) {
goto err;
}
pud = pud_offset(pgd, addr);
if (pud_none(*pud) || pud_bad(*pud)) {
goto err;
}
pmd = pmd_offset(pud, addr);
if (pmd_none(*pmd) || pmd_bad(*pmd)) {
goto err;
}
pte = pte_offset_map(pmd, addr);
if (!pte) {
goto err;
}
if (!pte_present(*pte)) {
PR("pte is not present\n");
goto err;
}
pg = pte_page(*pte);
if (!pg) {
pte_unmap(pte);
goto err;
}
pte_unmap(pte);
+3
source to share
2 answers
pte_none checks if there is a value in pte, pte_present presence flag.
#define pte_none(pte) (!pte_val(pte))
#define pte_present(pte) (pte_isset((pte), L_PTE_PRESENT))
so the condition for the pages being exchanged will be !pte_present && !pte_none
And in your case, you interpret all empty pets as unloaded ...
0
source to share