On Thu, Dec 05, 2019 at 07:25:51PM +0100, Martin Pieuchot wrote:
> Following cleanup diff:
>
> - reduces gratuitous differences with NetBSD,
> - merges multiple '#ifdef _KERNEL' blocks,
> - kills unused 'struct vm_map_intrsafe'
> - turns 'union vm_map_object' into a anonymous union (following to NetBSD)
> - move questionable vm_map_modflags() into uvm/uvm_map.c
> - remove guards around MAX_KMAPENT, it is defined only once
> - document lock differences
> - fix tab vs space
>
> Ok?
>
ok mlarkin
> Index: uvm/uvm_extern.h
> ===
> RCS file: /cvs/src/sys/uvm/uvm_extern.h,v
> retrieving revision 1.151
> diff -u -p -r1.151 uvm_extern.h
> --- uvm/uvm_extern.h 29 Nov 2019 06:34:45 - 1.151
> +++ uvm/uvm_extern.h 5 Dec 2019 16:06:33 -
> @@ -65,9 +65,6 @@ typedef int vm_fault_t;
> typedef int vm_inherit_t;/* XXX: inheritance codes */
> typedef off_t voff_t;/* XXX: offset within a uvm_object */
>
> -union vm_map_object;
> -typedef union vm_map_object vm_map_object_t;
> -
> struct vm_map_entry;
> typedef struct vm_map_entry *vm_map_entry_t;
>
> Index: uvm/uvm_map.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_map.c,v
> retrieving revision 1.256
> diff -u -p -r1.256 uvm_map.c
> --- uvm/uvm_map.c 4 Dec 2019 08:28:29 - 1.256
> +++ uvm/uvm_map.c 5 Dec 2019 16:27:22 -
> @@ -230,7 +230,6 @@ void vmspace_validate(struct
> vm_map*)
> #define PMAP_PREFER(addr, off) (addr)
> #endif
>
> -
> /*
> * The kernel map will initially be VM_MAP_KSIZE_INIT bytes.
> * Every time that gets cramped, we grow by at least VM_MAP_KSIZE_DELTA
> bytes.
> @@ -334,6 +333,14 @@ vaddr_t uvm_maxkaddr;
> MUTEX_ASSERT_LOCKED(&(_map)->mtx); \
> } \
> } while (0)
> +
> +#define vm_map_modflags(map, set, clear)
> \
> + do {\
> + mtx_enter(&(map)->flags_lock); \
> + (map)->flags = ((map)->flags | (set)) & ~(clear); \
> + mtx_leave(&(map)->flags_lock); \
> + } while (0)
> +
>
> /*
> * Tree describing entries by address.
> Index: uvm/uvm_map.h
> ===
> RCS file: /cvs/src/sys/uvm/uvm_map.h,v
> retrieving revision 1.65
> diff -u -p -r1.65 uvm_map.h
> --- uvm/uvm_map.h 29 Nov 2019 06:34:46 - 1.65
> +++ uvm/uvm_map.h 5 Dec 2019 16:26:09 -
> @@ -86,16 +86,6 @@
> #ifdef _KERNEL
>
> /*
> - * Internal functions.
> - *
> - * Required by clipping macros.
> - */
> -void uvm_map_clip_end(struct vm_map*, struct vm_map_entry*,
> - vaddr_t);
> -void uvm_map_clip_start(struct vm_map*,
> - struct vm_map_entry*, vaddr_t);
> -
> -/*
> * UVM_MAP_CLIP_START: ensure that the entry begins at or after
> * the starting address, if it doesn't we split the entry.
> *
> @@ -133,26 +123,6 @@ void uvm_map_clip_start(struct
> vm_map
> #include
>
> /*
> - * types defined:
> - *
> - * vm_map_tthe high-level address map data structure.
> - * vm_map_entry_t an entry in an address map.
> - * vm_map_version_ta timestamp of a map, for use with vm_map_lookup
> - */
> -
> -/*
> - * Objects which live in maps may be either VM objects, or another map
> - * (called a "sharing map") which denotes read-write sharing with other maps.
> - *
> - * XXXCDC: private pager data goes here now
> - */
> -
> -union vm_map_object {
> - struct uvm_object *uvm_obj; /* UVM OBJECT */
> - struct vm_map *sub_map; /* belongs to another map */
> -};
> -
> -/*
> * Address map entries consist of start and end addresses,
> * a VM object (or sharing map) and offset into that object,
> * and user-exported inheritance and protection information.
> @@ -177,23 +147,23 @@ struct vm_map_entry {
> vsize_t guard; /* bytes in guard */
> vsize_t fspace; /* free space */
>
> - union vm_map_object object; /* object I point to */
> + union {
> + struct uvm_object *uvm_obj; /* uvm object */
> + struct vm_map *sub_map; /* belongs to another map */
> + } object; /* object I point to */
> voff_t offset; /* offset into object */
> struct vm_aref aref; /* anonymous overlay */
> -
> int etype; /* entry type */
> -
> vm_prot_t protection; /* protection code */
>