Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2014 22:50:50 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266600 - in user/attilio/rm_vmobj_cache/sys: dev/drm2/ttm ia64/ia64 powerpc/aim vm x86/iommu
Message-ID:  <201405232250.s4NMooNJ099993@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri May 23 22:50:49 2014
New Revision: 266600
URL: http://svnweb.freebsd.org/changeset/base/266600

Log:
  vm_page_alloc_contig() is always called with the wiring attribute on
  as it is always returning unmanaged pages.
  Avoid to pass the attribute anymore and just force the wiring of pages
  on.

Modified:
  user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c
  user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_page_alloc.c
  user/attilio/rm_vmobj_cache/sys/ia64/ia64/pmap.c
  user/attilio/rm_vmobj_cache/sys/powerpc/aim/slb.c
  user/attilio/rm_vmobj_cache/sys/vm/vm_kern.c
  user/attilio/rm_vmobj_cache/sys/vm/vm_page.c
  user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c

Modified: user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_bo.c	Fri May 23 22:50:49 2014	(r266600)
@@ -1495,7 +1495,7 @@ int ttm_bo_global_init(struct drm_global
 	mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF);
 	glob->mem_glob = bo_ref->mem_glob;
 	glob->dummy_read_page = vm_page_alloc_contig(NULL, 0,
-	    VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED,
+	    VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ,
 	    1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE);
 
 	if (unlikely(glob->dummy_read_page == NULL)) {

Modified: user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_page_alloc.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_page_alloc.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/dev/drm2/ttm/ttm_page_alloc.c	Fri May 23 22:50:49 2014	(r266600)
@@ -492,7 +492,7 @@ static int ttm_alloc_new_pages(struct pg
 	unsigned max_cpages = min(count,
 			(unsigned)(PAGE_SIZE/sizeof(vm_page_t)));
 
-	aflags = VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ |
+	aflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ |
 	    ((ttm_alloc_flags & TTM_PAGE_FLAG_ZERO_ALLOC) != 0 ?
 	    VM_ALLOC_ZERO : 0);
 	
@@ -708,7 +708,7 @@ static int ttm_get_pages(vm_page_t *page
 	unsigned count;
 	int r;
 
-	aflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED |
+	aflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ |
 	    ((flags & TTM_PAGE_FLAG_ZERO_ALLOC) != 0 ? VM_ALLOC_ZERO : 0);
 
 	/* No pool for cached pages */

Modified: user/attilio/rm_vmobj_cache/sys/ia64/ia64/pmap.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/ia64/ia64/pmap.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/ia64/ia64/pmap.c	Fri May 23 22:50:49 2014	(r266600)
@@ -293,9 +293,8 @@ pmap_alloc_vhpt(void)
 	vm_size_t size;
 
 	size = 1UL << pmap_vhpt_log2size;
-	m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ |
-	    VM_ALLOC_WIRED, atop(size), 0UL, ~0UL, size, 0UL,
-	    VM_MEMATTR_DEFAULT);
+	m = vm_page_alloc_contig(NULL, 0, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ,
+	    atop(size), 0UL, ~0UL, size, 0UL, VM_MEMATTR_DEFAULT);
 	if (m != NULL) {
 		vhpt = IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m));
 		pmap_initialize_vhpt(vhpt);

Modified: user/attilio/rm_vmobj_cache/sys/powerpc/aim/slb.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/powerpc/aim/slb.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/powerpc/aim/slb.c	Fri May 23 22:50:49 2014	(r266600)
@@ -484,7 +484,7 @@ slb_uma_real_alloc(uma_zone_t zone, int 
 		realmax = platform_real_maxaddr();
 
 	*flags = UMA_SLAB_PRIV;
-	pflags = malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
+	pflags = malloc2vm_flags(wait) | VM_ALLOC_NOOBJ;
 
 	for (;;) {
 		m = vm_page_alloc_contig(NULL, 0, pflags, 1, 0, realmax,

Modified: user/attilio/rm_vmobj_cache/sys/vm/vm_kern.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/vm/vm_kern.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/vm/vm_kern.c	Fri May 23 22:50:49 2014	(r266600)
@@ -169,7 +169,7 @@ kmem_alloc_attr(vmem_t *vmem, vm_size_t 
 	if (vmem_alloc(vmem, size, M_BESTFIT | flags, &addr))
 		return (0);
 	offset = addr - VM_MIN_KERNEL_ADDRESS;
-	pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED;
+	pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY;
 	VM_OBJECT_WLOCK(object);
 	for (i = 0; i < size; i += PAGE_SIZE) {
 		tries = 0;
@@ -232,7 +232,7 @@ kmem_alloc_contig(struct vmem *vmem, vm_
 	if (vmem_alloc(vmem, size, flags | M_BESTFIT, &addr))
 		return (0);
 	offset = addr - VM_MIN_KERNEL_ADDRESS;
-	pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED;
+	pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY;
 	VM_OBJECT_WLOCK(object);
 	tries = 0;
 retry:

Modified: user/attilio/rm_vmobj_cache/sys/vm/vm_page.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/vm/vm_page.c	Fri May 23 22:50:49 2014	(r266600)
@@ -1676,6 +1676,8 @@ vm_page_alloc_contig_vdrop(struct spglis
  *
  *	The caller must always specify an allocation class.
  *
+ *	The returned pages will all be wired.
+ *
  *	allocation classes:
  *	VM_ALLOC_NORMAL		normal process request
  *	VM_ALLOC_SYSTEM		system *really* needs a page
@@ -1686,7 +1688,6 @@ vm_page_alloc_contig_vdrop(struct spglis
  *	VM_ALLOC_NOOBJ		page is not associated with an object and
  *				should not be exclusive busy 
  *	VM_ALLOC_SBUSY		shared busy the allocated page
- *	VM_ALLOC_WIRED		wire the allocated page
  *	VM_ALLOC_ZERO		prefer a zeroed page
  *
  *	This routine may not sleep.
@@ -1708,6 +1709,8 @@ vm_page_alloc_contig(vm_object_t object,
 	    (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)),
 	    ("vm_page_alloc: inconsistent object(%p)/req(%x)", (void *)object,
 	    req));
+	KASSERT((req & VM_ALLOC_WIRED) == 0,
+	    ("vm_page_alloc_contig: VM_ALLOC_WIRED passed in req (%x)", req));
 	if (object != NULL) {
 		VM_OBJECT_ASSERT_WLOCKED(object);
 		KASSERT(object->type == OBJT_PHYS,
@@ -1775,8 +1778,7 @@ retry:
 		flags = PG_ZERO;
 	if ((req & VM_ALLOC_NODUMP) != 0)
 		flags |= PG_NODUMP;
-	if ((req & VM_ALLOC_WIRED) != 0)
-		atomic_add_int(&vm_cnt.v_wire_count, npages);
+	atomic_add_int(&vm_cnt.v_wire_count, npages);
 	if (object != NULL) {
 		if (object->memattr != VM_MEMATTR_DEFAULT &&
 		    memattr == VM_MEMATTR_DEFAULT)
@@ -1792,8 +1794,8 @@ retry:
 			if ((req & VM_ALLOC_SBUSY) != 0)
 				m->busy_lock = VPB_SHARERS_WORD(1);
 		}
-		if ((req & VM_ALLOC_WIRED) != 0)
-			m->wire_count = 1;
+		m->wire_count = 1;
+
 		/* Unmanaged pages don't use "act_count". */
 		m->oflags = VPO_UNMANAGED;
 		if (object != NULL) {
@@ -1802,13 +1804,11 @@ retry:
 				    &deferred_vdrop_list);
 				if (vm_paging_needed())
 					pagedaemon_wakeup();
-				if ((req & VM_ALLOC_WIRED) != 0)
-					atomic_subtract_int(&vm_cnt.v_wire_count,
-					    npages);
+				atomic_subtract_int(&vm_cnt.v_wire_count,
+				    npages);
 				for (m_tmp = m, m = m_ret;
 				    m < &m_ret[npages]; m++) {
-					if ((req & VM_ALLOC_WIRED) != 0)
-						m->wire_count = 0;
+					m->wire_count = 0;
 					if (m >= m_tmp)
 						m->object = NULL;
 					vm_page_free(m);

Modified: user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c
==============================================================================
--- user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c	Fri May 23 22:39:00 2014	(r266599)
+++ user/attilio/rm_vmobj_cache/sys/x86/iommu/intel_utils.c	Fri May 23 22:50:49 2014	(r266600)
@@ -272,8 +272,8 @@ dmar_pgalloc(vm_object_t obj, vm_pindex_
 			break;
 		}
 		m = vm_page_alloc_contig(obj, idx, VM_ALLOC_NOBUSY |
-		    VM_ALLOC_SYSTEM | VM_ALLOC_NODUMP | VM_ALLOC_WIRED |
-		    zeroed, 1, 0, dmar_high, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
+		    VM_ALLOC_SYSTEM | VM_ALLOC_NODUMP | zeroed, 1, 0,
+		    dmar_high, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
 		if ((flags & DMAR_PGF_OBJL) == 0)
 			VM_OBJECT_WUNLOCK(obj);
 		if (m != NULL) {



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