svn commit: r282361 - in stable/10/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys

2015-05-03 Thread Alexander Motin
Author: mav
Date: Sun May  3 07:13:14 2015
New Revision: 282361
URL: https://svnweb.freebsd.org/changeset/base/282361

Log:
  MFC r281026, r281108, r281109:
  Make ZFS ARC track both KVA usage and fragmentation.
  
  Even on Illumos, with its much larger KVA, ZFS ARC steps back if KVA usage
  reaches certain threshold (3/4 on i386 or 16/17 otherwise).  FreeBSD has
  even less KVA, but had no such limit on archs with direct map as amd64.
  As result, on machines with a lot of RAM, during load with very small user-
  space memory pressure, such as `zfs send`, it was possible to reach state,
  when there is enough both physical RAM and KVA (I've seen up to 25-30%),
  but no continuous KVA range to allocate even single 128KB I/O request.
  
  Address this situation from two sides:
   - restore KVA usage limitations in a way the most close to Illumos;
   - introduce new requirement for KVA fragmentation, specifying that we
  should have at least one sequential KVA range of zfs_max_recordsize bytes.
  
  Experiments show that first limitation done alone is not sufficient.  On
  machine with 64GB of RAM it is sometimes needed to drop up to half of ARC
  size to get at leats one 1MB KVA chunk.  Statically limiting ARC to half
  of KVA/RAM is too strict, so second limitation makes it to work in cycles:
  accumulate trash up to certain critical mass, do massive spring-cleaning,
  and then start littering again.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/10/sys/kern/subr_vmem.c
  stable/10/sys/sys/vmem.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Sun May 
 3 04:24:29 2015(r282360)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Sun May 
 3 07:13:14 2015(r282361)
@@ -2606,8 +2606,11 @@ arc_reclaim_needed(void)
(vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC))  2);
return (1);
}
+#definezio_arena   NULL
+#else
+#definezio_arena   heap_arena
 #endif
-#ifdef sun
+
/*
 * If zio data pages are being allocated out of a separate heap segment,
 * then enforce that the size of available vmem for this arena remains
@@ -2621,7 +2624,14 @@ arc_reclaim_needed(void)
vmem_size(zio_arena, VMEM_FREE) 
(vmem_size(zio_arena, VMEM_ALLOC)  4))
return (1);
-#endif /* sun */
+
+   /*
+* Above limits know nothing about real level of KVA fragmentation.
+* Start aggressive reclamation if too little sequential KVA left.
+*/
+   if (vmem_size(heap_arena, VMEM_MAXFREE)  zfs_max_recordsize)
+   return (1);
+
 #else  /* _KERNEL */
if (spa_get_random(100) == 0)
return (1);

Modified: stable/10/sys/kern/subr_vmem.c
==
--- stable/10/sys/kern/subr_vmem.c  Sun May  3 04:24:29 2015
(r282360)
+++ stable/10/sys/kern/subr_vmem.c  Sun May  3 07:13:14 2015
(r282361)
@@ -1319,6 +1319,7 @@ vmem_add(vmem_t *vm, vmem_addr_t addr, v
 vmem_size_t
 vmem_size(vmem_t *vm, int typemask)
 {
+   int i;
 
switch (typemask) {
case VMEM_ALLOC:
@@ -1327,6 +1328,17 @@ vmem_size(vmem_t *vm, int typemask)
return vm-vm_size - vm-vm_inuse;
case VMEM_FREE|VMEM_ALLOC:
return vm-vm_size;
+   case VMEM_MAXFREE:
+   VMEM_LOCK(vm);
+   for (i = VMEM_MAXORDER - 1; i = 0; i--) {
+   if (LIST_EMPTY(vm-vm_freelist[i]))
+   continue;
+   VMEM_UNLOCK(vm);
+   return ((vmem_size_t)ORDER2SIZE(i) 
+   vm-vm_quantum_shift);
+   }
+   VMEM_UNLOCK(vm);
+   return (0);
default:
panic(vmem_size);
}

Modified: stable/10/sys/sys/vmem.h
==
--- stable/10/sys/sys/vmem.hSun May  3 04:24:29 2015(r282360)
+++ stable/10/sys/sys/vmem.hSun May  3 07:13:14 2015(r282361)
@@ -129,6 +129,7 @@ void vmem_startup(void);
 /* vmem_size typemask */
 #define VMEM_ALLOC 0x01
 #define VMEM_FREE  0x02
+#define VMEM_MAXFREE   0x10
 
 #endif /* _KERNEL */
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r282367 - stable/10/sys/dev/cxgbe

2015-05-03 Thread Navdeep Parhar
Author: np
Date: Sun May  3 18:54:17 2015
New Revision: 282367
URL: https://svnweb.freebsd.org/changeset/base/282367

Log:
  MFC r272183:
  
  Make sure the adapter's management queue and the event queue are
  available before any uppper layer driver (TOE, iWARP, or iSCSI)
  registers with the base cxgbe(4) driver.

Modified:
  stable/10/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/t4_main.c
==
--- stable/10/sys/dev/cxgbe/t4_main.c   Sun May  3 15:09:34 2015
(r282366)
+++ stable/10/sys/dev/cxgbe/t4_main.c   Sun May  3 18:54:17 2015
(r282367)
@@ -8262,6 +8262,12 @@ t4_activate_uld(struct adapter *sc, int 
 
SLIST_FOREACH(ui, t4_uld_list, link) {
if (ui-uld_id == id) {
+   if (!(sc-flags  FULL_INIT_DONE)) {
+   rc = adapter_full_init(sc);
+   if (rc != 0)
+   goto done;
+   }
+
rc = ui-activate(sc);
if (rc == 0)
ui-refcount++;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org