Skip to contentSkip to conversation

freemaps

PATCH Frederic Rossi (LMC) 4 participants 8 messages Dec 14, 2002 – Dec 16, 2002

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Hi,

This patch is intended to provide better support for allocations done with mmap. As mentioned by Ingo Molnar, keeping the last hole doesn't save us from scanning vmas because of size constraint.

The following patch implements a simple scheme. The goal is to quickly return virtual addresses but without scanning the address space at all. It also works for fixed mappings by reserving areas of virtual addresses.

A global (per mm) cache is maintained from which we can peek ranges of addresses. There is no link towards vmas. When addresses are cached out they are simply forgotten. It is then up to the vma users to explicitly cache out/back areas.

Two of the main functions used for allocations are:

vma_cache_detach(len) returns the first available range of this length starting from the first block in the cache. The overhead is still very low since only the cache is scanned (using a first-fit scheme).

vma_cache_area(addr, len) is used to reserve an area from addr to addr+len. This gives also the possibility to reserve in advance a bunch of virtual addresses without explicitly mapping them.

Caches are also accessible from /proc/<pid>/freemaps showing free areas along with their length. Applications willing to map to fixed addresses can check what is available before doing a mmap().

I guess it could probably give more control on the fragmentation of the virtual address space too. I successfully ran this patch in a desktop environment. I also did some simple testing to see how get_unmapped_area() reacts. Running the kernel 2.5.50 I get
100000 mmaps, mmap=2545 msec munmap=59 msec
100000 mmaps, mmap=2545 msec munmap=58 msec
100000 mmaps, mmap=2544 msec munmap=60 msec
100000 mmaps, mmap=2547 msec munmap=60 msec

and with freemaps I get
100000 mmaps, mmap=79 msec munmap=60 msec
100000 mmaps, mmap=79 msec munmap=60 msec
100000 mmaps, mmap=80 msec munmap=60 msec
100000 mmaps, mmap=79 msec munmap=60 msec

Since there is quite an amazing difference I really would like to have your comments on this.

I joined a patch against 2.5.50.

Regards,
Frederic

fs/binfmt_aout.c +3 -1
diff --exclude=RCS -BbNur linux-2.5.50/fs/binfmt_aout.c linux-2.5.50~/fs/binfmt_aout.c
@@ -24,6 +24,7 @@
 #include <linux/binfmts.h>
 #include <linux/personality.h>
 #include <linux/init.h>
+#include <linux/vma_cache.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -307,7 +308,8 @@
 		(current->mm->start_data = N_DATADDR(ex));
 	current->mm->brk = ex.a_bss +
 		(current->mm->start_brk = N_BSSADDR(ex));
-	current->mm->free_area_cache = TASK_UNMAPPED_BASE;
+
+	vma_cache_init (current->mm);
 
 	current->mm->rss = 0;
 	current->mm->mmap = NULL;
fs/binfmt_elf.c +4 -1
diff --exclude=RCS -BbNur linux-2.5.50/fs/binfmt_elf.c linux-2.5.50~/fs/binfmt_elf.c
@@ -35,6 +35,7 @@
 #include <linux/compiler.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/vma_cache.h>
 
 #include <asm/uaccess.h>
 #include <asm/param.h>
@@ -617,7 +618,9 @@
 	/* Do this so that we can load the interpreter, if need be.  We will
 	   change some of these later */
 	current->mm->rss = 0;
-	current->mm->free_area_cache = TASK_UNMAPPED_BASE;
+ 	
+ 	vma_cache_init (current->mm);
+
 	retval = setup_arg_pages(bprm);
 	if (retval < 0) {
 		send_sig(SIGKILL, current, 0);
fs/proc/array.c +94 -0

106 lines not on this page · raw message

fs/proc/base.c +21 -0
diff --exclude=RCS -BbNur linux-2.5.50/fs/proc/base.c linux-2.5.50~/fs/proc/base.c
@@ -54,6 +54,7 @@
 	PROC_PID_CMDLINE,
 	PROC_PID_STAT,
 	PROC_PID_STATM,
+	PROC_PID_VMC,
 	PROC_PID_MAPS,
 	PROC_PID_MOUNTS,
 	PROC_PID_WCHAN,
@@ -75,6 +76,7 @@
   E(PROC_PID_CMDLINE,	"cmdline",	S_IFREG|S_IRUGO),
   E(PROC_PID_STAT,	"stat",		S_IFREG|S_IRUGO),
   E(PROC_PID_STATM,	"statm",	S_IFREG|S_IRUGO),
+  E(PROC_PID_VMC,	"freemaps",	S_IFREG|S_IRUGO),
   E(PROC_PID_MAPS,	"maps",		S_IFREG|S_IRUGO),
   E(PROC_PID_MEM,	"mem",		S_IFREG|S_IRUSR|S_IWUSR),
   E(PROC_PID_CWD,	"cwd",		S_IFLNK|S_IRWXUGO),
@@ -99,6 +101,7 @@
 }
 
 ssize_t proc_pid_read_maps(struct task_struct*,struct file*,char*,size_t,loff_t*);
+ssize_t proc_pid_read_vmc(struct task_struct*,struct file*,char*,size_t,loff_t*);
 int proc_pid_stat(struct task_struct*,char*);
 int proc_pid_status(struct task_struct*,char*);
 int proc_pid_statm(struct task_struct*,char*);
@@ -336,6 +339,21 @@
 	.read		= pid_maps_read,
 };
 
+static ssize_t pid_vmc_read(struct file * file, char * buf,
+			      size_t count, loff_t *ppos)
+{
+	struct inode * inode = file->f_dentry->d_inode;
+	struct task_struct *task = proc_task(inode);
+	ssize_t res;
+
+	res = proc_pid_read_vmc (task, file, buf, count, ppos);
+	return res;
+}
+
+static struct file_operations proc_vmc_operations = {
+	read:		pid_vmc_read,
+};
+
 extern struct seq_operations mounts_op;
 static int mounts_open(struct inode *inode, struct file *file)
 {
@@ -1023,6 +1041,9 @@
 			inode->i_fop = &proc_info_file_operations;
 			ei->op.proc_read = proc_pid_statm;
 			break;
+		case PROC_PID_VMC:
+			inode->i_fop = &proc_vmc_operations;
+			break;
 		case PROC_PID_MAPS:
 			inode->i_fop = &proc_maps_operations;
 			break;
include/linux/init_task.h +1 -0
diff --exclude=RCS -BbNur linux-2.5.50/include/linux/init_task.h linux-2.5.50~/include/linux/init_task.h
@@ -41,6 +41,7 @@
 	.page_table_lock =  SPIN_LOCK_UNLOCKED, 		\
 	.mmlist		= LIST_HEAD_INIT(name.mmlist),		\
 	.default_kioctx = INIT_KIOCTX(name.default_kioctx, name),	\
+        .vma_cache_head = LIST_HEAD_INIT(name.vma_cache_head),  \
 }
 
 #define INIT_SIGNALS(sig) {	\
include/linux/sched.h +8 -1
diff --exclude=RCS -BbNur linux-2.5.50/include/linux/sched.h linux-2.5.50~/include/linux/sched.h
@@ -172,11 +172,16 @@
 
 #include <linux/aio.h>
 
+struct vma_cache_struct {
+	struct list_head head;
+	unsigned long vm_start;
+	unsigned long vm_end;
+};
+
 struct mm_struct {
 	struct vm_area_struct * mmap;		/* list of VMAs */
 	struct rb_root mm_rb;
 	struct vm_area_struct * mmap_cache;	/* last find_vma result */
-	unsigned long free_area_cache;		/* first hole */
 	pgd_t * pgd;
 	atomic_t mm_users;			/* How many users with user space? */
 	atomic_t mm_count;			/* How many references to "struct mm_struct" (users count as 1) */
@@ -189,6 +194,8 @@
 						 * by mmlist_lock
 						 */
 
+        struct list_head vma_cache_head;        /* cache for free virtual address areas */
+
 	unsigned long start_code, end_code, start_data, end_data;
 	unsigned long start_brk, brk, start_stack;
 	unsigned long arg_start, arg_end, env_start, env_end;
include/linux/slab.h +1 -0
diff --exclude=RCS -BbNur linux-2.5.50/include/linux/slab.h linux-2.5.50~/include/linux/slab.h
@@ -65,6 +65,7 @@
 extern int FASTCALL(kmem_cache_reap(int));
 
 /* System wide caches */
+extern kmem_cache_t	*vma_cache_cachep;
 extern kmem_cache_t	*vm_area_cachep;
 extern kmem_cache_t	*mm_cachep;
 extern kmem_cache_t	*names_cachep;
include/linux/vma_cache.h +25 -0
diff --exclude=RCS -BbNur linux-2.5.50/include/linux/vma_cache.h linux-2.5.50~/include/linux/vma_cache.h
@@ -0,0 +1,25 @@
+#ifndef _VMA_CACHE_H_
+#define _VMA_CACHE_H_
+
+#define VMA_CACHE_EMPTY(m,a)    (list_empty(&(a)->head))
+
+#define vma_cache_alloc()     (kmem_cache_alloc(vma_cache_cachep, GFP_KERNEL))
+#define vma_cache_free(v)                              \
+do {                                                   \
+        if (v) {                                       \
+                list_del_init (&(v)->head);            \
+                kmem_cache_free (vma_cache_cachep, v); \
+        }                                              \
+} while (0)
+
+int vma_cache_init (struct mm_struct *);
+struct vma_cache_struct *vma_cache_find (struct mm_struct *, unsigned long, int);
+void vma_cache_shtdn (struct mm_struct *);
+int vma_cache_attach (struct mm_struct *, unsigned long, int);
+int vma_cache_merge (struct mm_struct *, struct vma_cache_struct *, unsigned long, int);
+int vma_cache_clone (struct mm_struct *, struct mm_struct *);
+unsigned long vma_cache_area (struct mm_struct *, unsigned long, int);
+unsigned long vma_cache_detach (struct mm_struct *, int);
+
+#endif /* #ifndef _VMA_CACHE_H_ */
+
kernel/exit.c +1 -0
diff --exclude=RCS -BbNur linux-2.5.50/kernel/exit.c linux-2.5.50~/kernel/exit.c
@@ -21,6 +21,7 @@
 #include <linux/ptrace.h>
 #include <linux/profile.h>
 #include <linux/mount.h>
+#include <linux/vma_cache.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
kernel/fork.c +15 -2
diff --exclude=RCS -BbNur linux-2.5.50/kernel/fork.c linux-2.5.50~/kernel/fork.c
@@ -29,6 +29,7 @@
 #include <linux/futex.h>
 #include <linux/ptrace.h>
 #include <linux/mount.h>
+#include <linux/vma_cache.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -215,10 +216,10 @@
 
 	down_write(&oldmm->mmap_sem);
 	flush_cache_mm(current->mm);
+	vma_cache_init (mm);
 	mm->locked_vm = 0;
 	mm->mmap = NULL;
 	mm->mmap_cache = NULL;
-	mm->free_area_cache = TASK_UNMAPPED_BASE;
 	mm->map_count = 0;
 	mm->rss = 0;
 	mm->cpu_vm_mask = 0;
@@ -246,6 +247,7 @@
 				goto fail_nomem;
 			charge += len;
 		}
+		vma_cache_area (mm, mpnt->vm_start, mpnt->vm_end-mpnt->vm_start);
 		tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 		if (!tmp)
 			goto fail_nomem;
@@ -334,7 +336,7 @@
 	mm->page_table_lock = SPIN_LOCK_UNLOCKED;
 	mm->ioctx_list_lock = RW_LOCK_UNLOCKED;
 	mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm);
-	mm->free_area_cache = TASK_UNMAPPED_BASE;
+	vma_cache_init (mm);
 
 	if (likely(!mm_alloc_pgd(mm)))
 		return mm;
@@ -381,6 +383,7 @@
 		mmlist_nr--;
 		spin_unlock(&mmlist_lock);
 		exit_mmap(mm);
+		vma_cache_shtdn(mm);
 		mmdrop(mm);
 	}
 }
@@ -1054,6 +1057,9 @@
 /* SLAB cache for mm_struct structures (tsk->mm) */
 kmem_cache_t *mm_cachep;
 
+/* SLAB cache for vma_cache structures */
+kmem_cache_t *vma_cache_cachep;
+
 void __init proc_caches_init(void)
 {
 	sigact_cachep = kmem_cache_create("signal_act",
@@ -1085,4 +1091,11 @@
 			SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if(!mm_cachep)
 		panic("vma_init: Cannot alloc mm_struct SLAB cache");
+
+	vma_cache_cachep = kmem_cache_create("vma_cache_struct",
+			sizeof(struct vma_cache_struct), 0,
+			SLAB_HWCACHE_ALIGN, NULL, NULL);
+	if(!vm_area_cachep)
+		panic("vma_init: Cannot alloc vma_cache_struct SLAB cache");
+
 }
mm/Makefile +1 -1
diff --exclude=RCS -BbNur linux-2.5.50/mm/Makefile linux-2.5.50~/mm/Makefile
@@ -8,7 +8,7 @@
 	    vmalloc.o slab.o bootmem.o swap.o vmscan.o page_alloc.o \
 	    oom_kill.o shmem.o highmem.o mempool.o msync.o mincore.o \
 	    readahead.o pdflush.o page-writeback.o rmap.o madvise.o \
-	    vcache.o truncate.o
+	    vcache.o truncate.o vma_cache.o
 
 obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
 
mm/mmap.c +6 -27
diff --exclude=RCS -BbNur linux-2.5.50/mm/mmap.c linux-2.5.50~/mm/mmap.c
@@ -18,6 +18,7 @@
 #include <linux/security.h>
 #include <linux/hugetlb.h>
 #include <linux/profile.h>
+#include <linux/vma_cache.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -514,6 +515,7 @@
 	if (vma && vma->vm_start < addr + len) {
 		if (do_munmap(mm, addr, len))
 			return -ENOMEM;
+		vma_cache_area (mm, addr, len);
 		goto munmap_back;
 	}
 
@@ -647,7 +649,6 @@
 {
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
-	int found_hole = 0;
 
 	if (len > TASK_SIZE)
 		return -ENOMEM;
@@ -657,25 +658,9 @@
 		vma = find_vma(mm, addr);
 		if (TASK_SIZE - len >= addr &&
 		    (!vma || addr + len <= vma->vm_start))
-			return addr;
-	}
-	addr = mm->free_area_cache;
-
-	for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
-		/* At this point:  (!vma || addr < vma->vm_end). */
-		if (TASK_SIZE - len < addr)
-			return -ENOMEM;
-		/*
-		 * Record the first available hole.
-		 */
-		if (!found_hole && (!vma || addr < vma->vm_start)) {
-			mm->free_area_cache = addr;
-			found_hole = 1;
-		}
-		if (!vma || addr + len <= vma->vm_start)
-			return addr;
-		addr = vma->vm_end;
+			return vma_cache_area (current->mm, addr, len);
 	}
+	return vma_cache_detach (current->mm, len);
 }
 #else
 extern unsigned long arch_get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
@@ -688,7 +673,7 @@
 			return -ENOMEM;
 		if (addr & ~PAGE_MASK)
 			return -EINVAL;
-		return addr;
+		return vma_cache_area (current->mm, addr, len);
 	}
 
 	if (file && file->f_op && file->f_op->get_unmapped_area)
@@ -962,13 +947,8 @@
 	area->vm_mm->total_vm -= len >> PAGE_SHIFT;
 	if (area->vm_flags & VM_LOCKED)
 		area->vm_mm->locked_vm -= len >> PAGE_SHIFT;
-	/*
-	 * Is this a new hole at the lowest possible address?
-	 */
-	if (area->vm_start >= TASK_UNMAPPED_BASE &&
-				area->vm_start < area->vm_mm->free_area_cache)
-	      area->vm_mm->free_area_cache = area->vm_start;
 
+	vma_cache_attach (mm, area->vm_start, area->vm_end-area->vm_start);
 	remove_shared_vm_struct(area);
 
 	if (area->vm_ops && area->vm_ops->close)
@@ -1336,7 +1316,6 @@
 		kmem_cache_free(vm_area_cachep, mpnt);
 		mpnt = next;
 	}
-		
 }
 
 /* Insert vm structure into process list sorted by address
mm/vma_cache.c +364 -0

364 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Frederic Rossi (LMC)

...
100000 mmaps, mmap=2545 msec munmap=59 msec 100000 mmaps, mmap=2545 msec munmap=58 msec 100000 mmaps, mmap=2544 msec munmap=60 msec 100000 mmaps, mmap=2547 msec munmap=60 msec

Quoted 6 lines

and with freemaps I get
100000 mmaps, mmap=79 msec munmap=60 msec 100000 mmaps, mmap=79 msec munmap=60 msec 100000 mmaps, mmap=80 msec munmap=60 msec 100000 mmaps, mmap=79 msec munmap=60 msec

Yes, this is a real failing.

fs/proc/array.c line 518

Quoted 3 lines
fs/proc/array.c +2 -0
+ssize_t proc_pid_read_vmc (struct task_struct *task, struct file * file, char * buf, size_t count, loff_t *ppos)
+{

This should use the seq_file API.

include/linux/sched.h line 179

Quoted 5 lines
include/linux/sched.h +5 -0
+struct vma_cache_struct {
+	struct list_head head;
+	unsigned long vm_start;
+	unsigned long vm_end;
+};

So this is the key part. It is a per-mm linear list of unmapped areas.

You state that its locking is via mm->mmap_sem. I assume that means a down_write() of that semaphore?

As this is a linear list, I do not understand why it does not have similar failure modes to the current search. Suppose this list describes 100,000 4k unmapped areas and the application requests an 8k mmap??

mm/vma_cache.c line 40

Quoted 7 lines
mm/vma_cache.c +7 -0
+static __inline__ int vma_cache_chainout (struct mm_struct *mm, struct vma_cache_struct *vmc)
+{
+	if (!vmc)
+		return -EINVAL;
+
+	list_del_init (&vmc->head);
+	vma_cache_free (vmc);

vma_cache_free() already does the list_del_init(). --
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#2 lore raw
Quoted 1 line · Andrew Morton

So this is the key part. It is a per-mm linear list of unmapped areas.

yep.

Quoted 4 lines

As this is a linear list, I do not understand why it does not have similar failure modes to the current search. Suppose this list describes 100,000 4k unmapped areas and the application requests an 8k mmap??

i bet because in the (artificial?) test presented the 'hole' distribution is much nicer than the 'allocated areas' distribution. There are real-life allocation patterns, where this scheme suffers the same kind of regression the old scheme suffered. Eg. the one i presented originally, which triggered a regression, the NPTL stack allocator, where there is a 4K unmapped area between thread stacks. Under that workload the freemap-patched kernel will suffer badly over 2.5.50.

but the hole-index might in fact be a quality improvement in a number of cases. It wont save us in a number of other cases, but one thing is sure:
holes do not have types, allocated vmas have. So the complexity of the hole-space will always be at least as low as the complexity of the allocated-area-space. If there are lots of vmas of different types then the complexity of the hole-space can be significantly lower than the complexity of the vma-space. This happens quite often.

a hybrid approach would keep both improvements: take the hole index _plus_ the free-area cache i introduced, and if there's a cachemiss, search the hole-list.

another approach might be to maintain some sort of tree of holes.

Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#3 lore raw
Quoted 3 lines · Ingo Molnar

...
another approach might be to maintain some sort of tree of holes.

This one, I'd suggest. If we're going to fix this we may as well fix it right. Otherwise there will always be whacky failure modes.

Trees are tricky, because we don't like to recur.

I expect this could be solved with two trees:

- For searching, a radix-tree indexed by hole size. A list of same-sized holes at each leaf.

- For insertion (where we must perform merging) an rbtree.

But:

- Do we need to keep the lists of same-sized holes sorted by virtual address, to avoid fragmentation?

- Do all mm's incur all this stuff, or do we build it all when some threshold is crossed?

- How does it play with non-linear mappings?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#4 lore raw
Quoted 9 lines · Andrew Morton
Quoted 3 lines · Ingo Molnar

...
another approach might be to maintain some sort of tree of holes.

This one, I'd suggest. If we're going to fix this we may as well fix it right. Otherwise there will always be whacky failure modes.

Quoted 8 lines

Trees are tricky, because we don't like to recur.

I expect this could be solved with two trees:

- For searching, a radix-tree indexed by hole size. A list of same-sized holes at each leaf.

- For insertion (where we must perform merging) an rbtree.

yes. I suspect this is close to what Andrea has/had in mind?

Quoted 4 lines

But:

- Do we need to keep the lists of same-sized holes sorted by virtual address, to avoid fragmentation?

the best anti-fragmentation technique is i guess what we have now: to use the smallest matching hole at the lowest possible address. I think we should give up strong anti-fragmentation techniques only once 32-bit address spaces have become a distant memory, definitely not these days, when the problems created by the limits of the 32-bit address space are probably at their peak point in history.

but, before we go forward, i'd really suggest to run _real_ tests. The free-area cache i added was to address one specific real-life workload. Frederic's test i dont know. One area i'd suspect we still suck somewhat are the JITs and the memory protectorsm, but the loss due to the free-area searching has to be quantified. Obviously, until trees are introduced there will always be regressions.

Quoted 2 lines

- Do all mm's incur all this stuff, or do we build it all when some threshold is crossed?

we had some sort of threshold ages ago - i'd rather have a fast constructor for this stuff instead of trying to hide the costs by cutting off the small-size cases. I think basically everything but benchmarks will have more than just a few mappings.

Quoted 1 line

- How does it play with non-linear mappings?

nonlinear mappings do not care about the structure of vmas (and the structure of inverse vmas) - they are special types of vmas.

Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#5 lore raw
In reply to Andrew Morton
Quoted 4 lines · Andrew Morton

I expect this could be solved with two trees:
- For searching, a radix-tree indexed by hole size. A list of same-sized holes at each leaf.
- For insertion (where we must perform merging) an rbtree.

It's not quite that easy, because what this appears to suggest would result in best fit, not address-ordered first fit.

My first thought is a length-constrained address minimization on a 2-d tree, quadtree, or 2D k-d-b tree keyed on address and length; the duelling tree solutions aren't really capable of providing O(lg(n)) guarantees for address-ordered first fit (or implementing address- ordered first fit at all). I have no clue how to do this both nonrecursively and without frequently-dirtied temporary node linkage, though, as it appears to require a work stack (or potentially even a queue for prioritized searches) like many other graph searches. Also, I don't have a proof in hand that this is really O(lg(n)) worst-case, though there are relatively obvious intuitive reasons to suspect so.

Quoted 3 lines · Andrew Morton

But:
- Do we need to keep the lists of same-sized holes sorted by virtual address, to avoid fragmentation?

Well, not so much to avoid fragmentation, but avoid worst cases.

Quoted 2 lines · Andrew Morton

- Do all mm's incur all this stuff, or do we build it all when some threshold is crossed?

Not all incur these kinds of problems; but it is probably expensive to build non-incrementally once the threshold is crossed.

Quoted 1 line · Andrew Morton

- How does it play with non-linear mappings?

It doesn't care; they're just vma's parked on a virtual address range like the rest of them.

Bill
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#6 lore raw
Quoted 7 lines · William Lee Irwin III
Quoted 1 line · Andrew Morton

- How does it play with non-linear mappings?

It doesn't care; they're just vma's parked on a virtual address range like the rest of them.

But the searching needs are different. If someone has a nonlinear mmap of the 0-1M region of a file and then requests an mmap of the 4-5M region, that can just be tacked onto the 0-1M mapping's vma (can't it?). --
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#7 lore raw
Quoted 1 line · Andrew Morton
Quoted 1 line
Quoted 1 line

- How does it play with non-linear mappings?

Quoted 2 lines · William Lee Irwin III
Quoted 2 lines

It doesn't care; they're just vma's parked on a virtual address range like the rest of them.

Quoted 3 lines · Andrew Morton

But the searching needs are different. If someone has a nonlinear mmap of the 0-1M region of a file and then requests an mmap of the 4-5M region, that can just be tacked onto the 0-1M mapping's vma (can't it?).

Well, that's more of a merging criterion that a search criterion. At any rate, while it's true that they can/could be merged arbitrarily since they're not actually associated with any particular file offset range, there isn't any indicator I know of now that would actually allow this distinction wrt. mergeability to be made.

Bill
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/