Re: mmap() and remap_page_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Martin" == Martin Maletinsky <maletinsky@scs.ch> writes:

Martin> In the char/mem.c driver code, the VM_RESERVED flag is set in
Martin> the vma structure. The swap_out_pmd() function uses the
Martin> PageReserved() macro, to check if a page structure's
Martin> PG_reserved flag is set. Did I overlook something, or is there
Martin> any relation between a vma structure's VM_RESERVED flag and
Martin> the page structures's PG_reserved flag.

Martin> Also I noticed, that pte_remap_page_range() which is called
Martin> during execution of remap_page_range() does explicitely check
Martin> the PG_reserved flag of the page to be mapped (as shown in the
Martin> subsequent lines of code).

Martin> if ((!VALID_PAGE(page)) || PageReserved(page))
Martin>                          set_pte(pte, mk_pte_phys(phys_addr, prot));

Martin> So why does the memory mapping with the remap_page_range()
Martin> call of the char/mem.c driver succeed although it doesn't set
Martin> the reserved bit of the corresponding page structure (but only
Martin> of the corresponding vm area)?

Uh, oh, indeed VM_RESERVED is checked earlier:

vmscan.c:
/* mm->page_table_lock is held. mmap_sem is not held */
static inline int swap_out_vma(struct mm_struct * mm, struct vm_area_struct * vma, unsigned long address, int count, zone_t * classzone)
{
	pgd_t *pgdir;
	unsigned long end;

	/* Don't swap out areas which are reserved */
	if (vma->vm_flags & VM_RESERVED)
		return count;

[...]


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux