linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* About performance related to do_map
@ 2001-05-15 17:13 Hua Ji
  0 siblings, 0 replies; only message in thread
From: Hua Ji @ 2001-05-15 17:13 UTC (permalink / raw)
  To: linux-mm

Folks,

When reading source codes, get a question. Thanks in advance.

Function do_map() ./mm/mmap.c,

After/if we get a vma by using **get_unmapped_area**, why we still
double-check
the vma area by using do_munmap()? 

This call to do_munmap()is ONLY NECESSARY when (flags & MAP_FIXED) is
**TRUE**.

The do_munmap will bring some EXTRA cost with the look up the vma linked
list or/and AVL tree.

Also, why not check it first before we create a new vma area? We don't have
to create a vma first and then release it afterwards when lateron we find
out that this vma is overlapped by some other vma area already.

Mike
------------------------------------------------
 /* Obtain the address to map to. we verify (or select) it and ensure
	 * that it represents a valid section of the address space.
	 */
	if (flags & MAP_FIXED) {
		if (addr & ~PAGE_MASK)
			return -EINVAL;
	} else {
		addr = get_unmapped_area(addr, len);
		if (!addr)
			return -ENOMEM;
	}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-15 17:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15 17:13 About performance related to do_map Hua Ji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox