Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Dec 2008 21:46:44 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 154663 for review
Message-ID:  <200812142146.mBELkitV030355@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154663

Change 154663 by zec@zec_tca51 on 2008/12/14 21:45:46

	Mostly futile attempt at diff reductions head / vimage.

Affected files ...

.. //depot/projects/vimage/src/sys/conf/files#49 edit
.. //depot/projects/vimage/src/sys/contrib/pf/net/pfvar.h#9 edit
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#73 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_src.c#32 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#40 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.h#13 edit
.. //depot/projects/vimage/src/sys/netipsec/ipsec.c#36 edit
.. //depot/projects/vimage/src/sys/sys/vimage.h#76 edit

Differences ...

==== //depot/projects/vimage/src/sys/conf/files#49 (text+ko) ====

@@ -1952,9 +1952,8 @@
 kern/kern_timeout.c		standard
 kern/kern_umtx.c		standard
 kern/kern_uuid.c		standard
-kern/kern_vimage.c		optional vimage
+kern/kern_vimage.c		standard
 kern/kern_xxx.c			standard
-kern/kern_vimage.c		standard
 kern/link_elf.c			standard
 kern/linker_if.m		standard
 kern/md4c.c			optional netsmb

==== //depot/projects/vimage/src/sys/contrib/pf/net/pfvar.h#9 (text+ko) ====

@@ -1856,15 +1856,6 @@
 	pf_osfp_validate(void);
 
 /*
- * Stack virtualization support.
- */
-#ifdef VIMAGE
-struct vnet_pf {
-	struct vnet		*parent_vnet;
-};
-#endif
-
-/*
  * Symbol translation macros
  */
 #define	INIT_VNET_PF(vnet) \

==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#73 (text+ko) ====

@@ -66,7 +66,7 @@
 
 //#define DEBUG_ORDERING
 
-MALLOC_DEFINE(M_VIMAGE, "vimage", "virtual image resource container");
+MALLOC_DEFINE(M_VIMAGE, "vimage", "vimage resource container");
 MALLOC_DEFINE(M_VNET, "vnet", "network stack control block");
 MALLOC_DEFINE(M_VPROCG, "vprocg", "process group control block");
 MALLOC_DEFINE(M_VCPU, "vcpu", "cpu resource control block");
@@ -84,42 +84,8 @@
 #endif
 #endif
 
-#ifdef VI_PREALLOC_SIZE
-/*
- * A private memory allocator can be enabled by setting VI_PREALLOC_SIZE
- * to amount of memory (in bytes) to be reserved for the allocator at
- * boot time.  This pool is guaranteed to reside on a 4M superpage(s) on
- * i386 and amd64, thus potentially reducing TLB trashing.
- *
- * So far I couldn't observe any significant performance impact of using
- * this allocator vs. the standard malloc(), whereas in FreeBSD 4.11
- * days I recall using "uninitialized data" storage vs. malloc() would
- * be an instant win...  Is it possible that these days all malloc'ed
- * kernel storage is automagically placed on 4M superpages, so that this
- * effort is redundant?  Who knows...  Therefore this code is disabled by
- * default, so vi_alloc() and vi_free() simply resolve to standard
- * malloc() and free().
- */
-
-static void *vi_malloc(unsigned long, struct malloc_type *, int);
-static void vi_free(void *, struct malloc_type *);
-
-struct vi_mtrack {
-	LIST_ENTRY(vi_mtrack)	 vmt_le;
-	char			*vmt_addr;
-	size_t			 vmt_size;
-	int			 vmt_flags;
-};
-
-static char vi_mpool[VI_PREALLOC_SIZE];
-static struct uma_zone *vi_mtrack_zone;
-static LIST_HEAD(, vi_mtrack) vi_mem_free_head;
-static LIST_HEAD(, vi_mtrack) vi_mem_alloc_head;
-static int vi_mpool_fail_cnt = 0;
-#else
 #define vi_malloc(addr, type, flags) malloc((addr), (type), (flags))
 #define vi_free(addr, type) free((addr), (type))
-#endif /* VI_PREALLOC_SIZE */
 
 #ifndef VIMAGE_GLOBALS
 static TAILQ_HEAD(vnet_modlink_head, vnet_modlink) vnet_modlink_head;
@@ -869,19 +835,6 @@
 static void
 vi_init(void *unused)
 {
-#ifdef VI_PREALLOC_SIZE
-	struct vi_mtrack *vmt;
-
-	/* Initialize our private memory allocator */
-	LIST_INIT(&vi_mem_free_head);
-	LIST_INIT(&vi_mem_alloc_head);
-	vi_mtrack_zone = uma_zcreate("vi_mtrack", sizeof(struct vi_mtrack),
-	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
-	vmt = uma_zalloc(vi_mtrack_zone, M_NOWAIT);
-	vmt->vmt_addr = vi_mpool;
-	vmt->vmt_size = VI_PREALLOC_SIZE;
-	LIST_INSERT_HEAD(&vi_mem_free_head, vmt, vmt_le);
-#endif /* VI_PREALLOC_SIZE */
 
 	/* vnet module list is both forward and reverse traversable */
 	TAILQ_INIT(&vnet_modlink_head);
@@ -924,77 +877,6 @@
 SYSINIT(vimage, SI_SUB_VIMAGE, SI_ORDER_FIRST, vi_init, NULL);
 SYSINIT(vimage_done, SI_SUB_VIMAGE_DONE, SI_ORDER_FIRST, vi_init_done, NULL);
 
-#ifdef VI_PREALLOC_SIZE
-void *
-vi_malloc(unsigned long size, struct malloc_type *type, int flags)
-{
-	void *addr;
-	struct vi_mtrack *vmt = NULL;
-	struct vi_mtrack *vmt_iter;
-
-	/* Attempt to find a free chunk in our private pool */
-	LIST_FOREACH(vmt_iter, &vi_mem_free_head, vmt_le)
-		if (vmt_iter->vmt_size >= size &&
-		    (vmt == NULL || vmt_iter->vmt_size < vmt->vmt_size)) {
-			vmt = vmt_iter;
-			/* Exact fit is an optimal choice, we are done. */
-			if (vmt_iter->vmt_size == size)
-				break;
-		}
-	
-	/* Not (enough) free space in our pool, resort to malloc() */
-	if (vmt == NULL) {
-		if (vi_mpool_fail_cnt == 0)
-			printf("vi_mpool exhausted,"
-			    "consider increasing VI_PREALLOC_SIZE\n");
-		vi_mpool_fail_cnt++;
-		addr = malloc(size, type, flags);
-		return addr;
-	}
-
-	addr = vmt->vmt_addr;
-	if (vmt->vmt_size == size) {
-		/* Move the descriptor from free to allocated list */
-		LIST_REMOVE(vmt, vmt_le);
-		LIST_INSERT_HEAD(&vi_mem_alloc_head, vmt, vmt_le);
-	} else {
-		/* Shrink the existing free space block */
-		vmt->vmt_addr += size;
-		vmt->vmt_size -= size;
-
-		/* Create a new descriptor and place it on allocated list */
-		vmt = uma_zalloc(vi_mtrack_zone, M_NOWAIT);
-		vmt->vmt_addr = addr;
-		vmt->vmt_size = size;
-		LIST_INSERT_HEAD(&vi_mem_alloc_head, vmt, vmt_le);
-	}
-
-	bzero(addr, size);
-	return addr;
-}
-
-void
-vi_free(void *addr, struct malloc_type *type)
-{
-	struct vi_mtrack *vmt;
-
-	/* Attempt to find the chunk in our allocated pool */
-	LIST_FOREACH(vmt, &vi_mem_alloc_head, vmt_le)
-		if (vmt->vmt_addr == addr)
-				break;
-	
-	/* Not found in our private pool, resort to free() */
-	if (vmt == NULL) {
-		free(addr, type);
-		return;
-	}
-
-	/* Move the descriptor from allocated to free list */
-	LIST_REMOVE(vmt, vmt_le);
-	LIST_INSERT_HEAD(&vi_mem_free_head, vmt, vmt_le);
-}
-#endif /* VI_PREALLOC_SIZE */
-
 #ifdef DDB
 static void
 db_vnet_ptr(void *arg)

==== //depot/projects/vimage/src/sys/netinet6/in6_src.c#32 (text+ko) ====

@@ -1003,8 +1003,10 @@
 	struct in6_addrpolicy ape_policy;
 };
 
+TAILQ_HEAD(addrsel_policyhead, addrsel_policyent);
+
 #ifdef VIMAGE_GLOBALS
-TAILQ_HEAD(, addrsel_policyent) addrsel_policytab;
+struct addrsel_policyhead addrsel_policytab;
 #endif
 
 static void

==== //depot/projects/vimage/src/sys/netinet6/nd6.c#40 (text+ko) ====

@@ -154,8 +154,8 @@
 
 	V_nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
 
+	V_dad_ignore_ns = 0;	/* ignore NS in DAD - specwise incorrect*/
 	V_dad_maxtry = 15;	/* max # of *tries* to transmit DAD packet */
-	V_dad_ignore_ns = 0;	/* ignore NS in DAD - specwise incorrect*/
 
 	V_llinfo_nd6.ln_next = &V_llinfo_nd6;
 	V_llinfo_nd6.ln_prev = &V_llinfo_nd6;

==== //depot/projects/vimage/src/sys/netinet6/nd6.h#13 (text+ko) ====

@@ -341,6 +341,7 @@
 extern struct nd_prhead nd_prefix;
 extern int nd6_debug;
 extern int nd6_onlink_ns_rfc4861;
+
 extern struct callout nd6_timer_ch;
 
 /* nd6_rtr.c */

==== //depot/projects/vimage/src/sys/netipsec/ipsec.c#36 (text+ko) ====

@@ -108,8 +108,8 @@
 static int vnet_ipsec_idetach(const void *);
 #endif
 
+#ifdef VIMAGE_GLOBALS
 /* NB: name changed so netstat doesn't use it */
-#ifdef VIMAGE_GLOBALS
 struct ipsecstat ipsec4stat;
 struct secpolicy ip4_def_policy;
 int ipsec_debug;

==== //depot/projects/vimage/src/sys/sys/vimage.h#76 (text+ko) ====

@@ -297,27 +297,27 @@
 #else /* !VIMAGE */
 
 /* Non-VIMAGE null-macros */
-#define CURVNET_SET(arg)
-#define CURVNET_SET_QUIET(arg)
-#define CURVNET_RESTORE()
-#define VNET_ASSERT(condition)
-#define INIT_FROM_VNET(vnet, modindex, modtype, sym)
-#define VNET_ITERATOR_DECL(arg)
-#define VNET_FOREACH(arg)
-#define VNET_LIST_RLOCK()
-#define VNET_LIST_RUNLOCK()
-#define INIT_VPROCG(arg)
-#define VPROCG_ITERLOOP_BEGIN()
-#define VPROCG_ITERLOOP_END()
-#define INIT_VCPU(arg)
-#define TD_TO_VIMAGE(td)
-#define TD_TO_VNET(td)
-#define TD_TO_VPROCG(td)
-#define TD_TO_VCPU(td)
-#define P_TO_VIMAGE(p)
-#define P_TO_VNET(p)
-#define P_TO_VPROCG(p)
-#define P_TO_VCPU(p)
+#define	CURVNET_SET(arg)
+#define	CURVNET_SET_QUIET(arg)
+#define	CURVNET_RESTORE()
+#define	VNET_ASSERT(condition)
+#define	INIT_FROM_VNET(vnet, modindex, modtype, sym)
+#define	VNET_ITERATOR_DECL(arg)
+#define	VNET_FOREACH(arg)
+#define	VNET_LIST_RLOCK()
+#define	VNET_LIST_RUNLOCK()
+#define	INIT_VPROCG(arg)
+#define	VPROCG_ITERLOOP_BEGIN()
+#define	VPROCG_ITERLOOP_END()
+#define	INIT_VCPU(arg)
+#define	TD_TO_VIMAGE(td)
+#define	TD_TO_VNET(td)
+#define	TD_TO_VPROCG(td)
+#define	TD_TO_VCPU(td)
+#define	P_TO_VIMAGE(p)
+#define	P_TO_VNET(p)
+#define	P_TO_VPROCG(p)
+#define	P_TO_VCPU(p)
 
 #endif /* !VIMAGE */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812142146.mBELkitV030355>