Skip to contentSkip to conversation

Further nommu changes

PATCH New David Howells 1 participant 1 message Nov 16, 2004

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

PATCH 1/3 Further nommu changes

The attached patch further changes the nommu stuff previously changed. These new changes do the following:

(0) Some additional variables have been defined to make nommu even compile.

(1) Get rid of the alternate vm_area_struct. The nommu mmap now uses the normal one. There's a refcount field added to the normal one, contingent on !CONFIG_MMU.

(2) vm_rb is now used to keep track of the VMAs in an rbtree rather than adding a separate list.

(3) mm_tblock_struct is now vm_list_struct.

(4) put_vma() now calls vma->vm_ops->close() if available on nommu.

(5) A dummy generic_file_vm_ops has been provided. It does nothing, but permits tiny-shmem to compile.

tiny-shmem and ramfs still need attention, such that files contained therein can be mmapped shared-writably to some extent on nommu.

---
warthog>diffstat nommu-2610rc2mm1.diff

 include/linux/mm.h |   30 +++-----
 mm/nommu.c         |  177 ++++++++++++++++++++++++++++++++++++-----------------
 mm/tiny-shmem.c    |    2 
 3 files changed, 134 insertions(+), 75 deletions(-)
include/linux/mm.h renamed from warthog/kernels/linux-2.6.10-rc2-mm1/include/linux/mm.h +12 -18
diff -uNrp /warthog/kernels/linux-2.6.10-rc2-mm1/include/linux/mm.h linux-2.6.10-rc2-mm1-frv/include/linux/mm.h
@@ -62,7 +62,6 @@ extern int sysctl_legacy_va_layout;
  * space that has a special rule for the page-fault handlers (ie a shared
  * library, the executable area etc).
  */
-#ifdef CONFIG_MMU
 struct vm_area_struct {
 	struct mm_struct * vm_mm;	/* The address space we belong to. */
 	unsigned long vm_start;		/* Our start address within vm_mm. */
@@ -112,34 +111,29 @@ struct vm_area_struct {
 	void * vm_private_data;		/* was vm_pte (shared mem) */
 	unsigned long vm_truncate_count;/* truncate_count or restart_addr */
 
+#ifndef CONFIG_MMU
+	atomic_t vm_usage;		/* refcount (VMAs shared if !MMU) */
+#endif
 #ifdef CONFIG_NUMA
 	struct mempolicy *vm_policy;	/* NUMA policy for the VMA */
 #endif
 };
 
-#else
-
-struct vm_area_struct {
-	struct list_head	vm_link;	/* system object list */
-	atomic_t		vm_usage;	/* count of refs */
-	unsigned long		vm_start;
-	unsigned long		vm_end;
-	pgprot_t		vm_page_prot;	/* access permissions of this VMA */
-	unsigned long		vm_flags;
-	unsigned long		vm_pgoff;
-	struct file		*vm_file;	/* file or device mapped */
-};
-
-struct mm_tblock_struct {
-	struct mm_tblock_struct	*next;
+/*
+ * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
+ * disabled, then there's a single shared list of VMAs maintained by the
+ * system, and mm's subscribe to these individually
+ */
+struct vm_list_struct {
+	struct vm_list_struct	*next;
 	struct vm_area_struct	*vma;
 };
 
-extern struct list_head nommu_vma_list;
+#ifndef CONFIG_MMU
+extern struct rb_root nommu_vma_tree;
 extern struct rw_semaphore nommu_vma_sem;
 
 extern unsigned int kobjsize(const void *objp);
-
 #endif
 
 /*
mm/nommu.c renamed from warthog/kernels/linux-2.6.10-rc2-mm1/mm/nommu.c +122 -55

345 lines not on this page · raw message

mm/tiny-shmem.c renamed from warthog/kernels/linux-2.6.10-rc2-mm1/mm/tiny-shmem.c +0 -2
diff -uNrp /warthog/kernels/linux-2.6.10-rc2-mm1/mm/tiny-shmem.c linux-2.6.10-rc2-mm1-frv/mm/tiny-shmem.c
@@ -112,9 +112,7 @@ int shmem_zero_setup(struct vm_area_stru
 	if (vma->vm_file)
 		fput(vma->vm_file);
 	vma->vm_file = file;
-#ifdef CONFIG_MMU
 	vma->vm_ops = &generic_file_vm_ops;
-#endif
 	return 0;
 }