Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Mar 2017 16:35:36 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315077 - in head: sys/vm tools/tools/umastat
Message-ID:  <201703111635.v2BGZauQ045304@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sat Mar 11 16:35:36 2017
New Revision: 315077
URL: https://svnweb.freebsd.org/changeset/base/315077

Log:
  uma: eliminate uk_slabsize field
  
  The field was not used beyond the initial keg setup stage anyway.
  
  MFC after:	1 month (if ever)

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_int.h
  head/tools/tools/umastat/umastat.c

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c	Sat Mar 11 16:00:49 2017	(r315076)
+++ head/sys/vm/uma_core.c	Sat Mar 11 16:35:36 2017	(r315077)
@@ -1218,15 +1218,16 @@ keg_small_init(uma_keg_t keg)
 	u_int memused;
 	u_int wastedspace;
 	u_int shsize;
+	u_int slabsize;
 
 	if (keg->uk_flags & UMA_ZONE_PCPU) {
 		u_int ncpus = (mp_maxid + 1) ? (mp_maxid + 1) : MAXCPU;
 
-		keg->uk_slabsize = sizeof(struct pcpu);
+		slabsize = sizeof(struct pcpu);
 		keg->uk_ppera = howmany(ncpus * sizeof(struct pcpu),
 		    PAGE_SIZE);
 	} else {
-		keg->uk_slabsize = UMA_SLAB_SIZE;
+		slabsize = UMA_SLAB_SIZE;
 		keg->uk_ppera = 1;
 	}
 
@@ -1236,8 +1237,8 @@ keg_small_init(uma_keg_t keg)
 	 * allocation bits for we round it up.
 	 */
 	rsize = keg->uk_size;
-	if (rsize < keg->uk_slabsize / SLAB_SETSIZE)
-		rsize = keg->uk_slabsize / SLAB_SETSIZE;
+	if (rsize < slabsize / SLAB_SETSIZE)
+		rsize = slabsize / SLAB_SETSIZE;
 	if (rsize & keg->uk_align)
 		rsize = (rsize & ~keg->uk_align) + (keg->uk_align + 1);
 	keg->uk_rsize = rsize;
@@ -1251,12 +1252,12 @@ keg_small_init(uma_keg_t keg)
 	else 
 		shsize = sizeof(struct uma_slab);
 
-	keg->uk_ipers = (keg->uk_slabsize - shsize) / rsize;
+	keg->uk_ipers = (slabsize - shsize) / rsize;
 	KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_SETSIZE,
 	    ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
 
 	memused = keg->uk_ipers * rsize + shsize;
-	wastedspace = keg->uk_slabsize - memused;
+	wastedspace = slabsize - memused;
 
 	/*
 	 * We can't do OFFPAGE if we're internal or if we've been
@@ -1277,9 +1278,9 @@ keg_small_init(uma_keg_t keg)
 	 * Historically this was not done because the VM could not
 	 * efficiently handle contiguous allocations.
 	 */
-	if ((wastedspace >= keg->uk_slabsize / UMA_MAX_WASTE) &&
-	    (keg->uk_ipers < (keg->uk_slabsize / keg->uk_rsize))) {
-		keg->uk_ipers = keg->uk_slabsize / keg->uk_rsize;
+	if ((wastedspace >= slabsize / UMA_MAX_WASTE) &&
+	    (keg->uk_ipers < (slabsize / keg->uk_rsize))) {
+		keg->uk_ipers = slabsize / keg->uk_rsize;
 		KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_SETSIZE,
 		    ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
 #ifdef UMA_DEBUG
@@ -1288,8 +1289,8 @@ keg_small_init(uma_keg_t keg)
 		    "maximum wasted space allowed = %d, "
 		    "calculated ipers = %d, "
 		    "new wasted space = %d\n", keg->uk_name, wastedspace,
-		    keg->uk_slabsize / UMA_MAX_WASTE, keg->uk_ipers,
-		    keg->uk_slabsize - keg->uk_ipers * keg->uk_rsize);
+		    slabsize / UMA_MAX_WASTE, keg->uk_ipers,
+		    slabsize - keg->uk_ipers * keg->uk_rsize);
 #endif
 		keg->uk_flags |= UMA_ZONE_OFFPAGE;
 	}
@@ -1322,7 +1323,6 @@ keg_large_init(uma_keg_t keg)
 	    ("%s: Cannot large-init a UMA_ZONE_PCPU keg", __func__));
 
 	keg->uk_ppera = howmany(keg->uk_size, PAGE_SIZE);
-	keg->uk_slabsize = keg->uk_ppera * PAGE_SIZE;
 	keg->uk_ipers = 1;
 	keg->uk_rsize = keg->uk_size;
 
@@ -1374,7 +1374,6 @@ keg_cachespread_init(uma_keg_t keg)
 	pages = MIN(pages, (128 * 1024) / PAGE_SIZE);
 	keg->uk_rsize = rsize;
 	keg->uk_ppera = pages;
-	keg->uk_slabsize = UMA_SLAB_SIZE;
 	keg->uk_ipers = ((pages * PAGE_SIZE) + trailer) / rsize;
 	keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB;
 	KASSERT(keg->uk_ipers <= SLAB_SETSIZE,

Modified: head/sys/vm/uma_int.h
==============================================================================
--- head/sys/vm/uma_int.h	Sat Mar 11 16:00:49 2017	(r315076)
+++ head/sys/vm/uma_int.h	Sat Mar 11 16:35:36 2017	(r315077)
@@ -210,7 +210,6 @@ struct uma_keg {
 	vm_offset_t	uk_kva;		/* Zone base KVA */
 	uma_zone_t	uk_slabzone;	/* Slab zone backing us, if OFFPAGE */
 
-	uint16_t	uk_slabsize;	/* Slab size for this keg */
 	uint16_t	uk_pgoff;	/* Offset to uma_slab struct */
 	uint16_t	uk_ppera;	/* pages per allocation from backend */
 	uint16_t	uk_ipers;	/* Items per slab */

Modified: head/tools/tools/umastat/umastat.c
==============================================================================
--- head/tools/tools/umastat/umastat.c	Sat Mar 11 16:00:49 2017	(r315076)
+++ head/tools/tools/umastat/umastat.c	Sat Mar 11 16:35:36 2017	(r315077)
@@ -374,7 +374,6 @@ main(int argc, char *argv[])
 		printf("  uk_rsize = %d\n", kz.uk_rsize);
 		printf("  uk_maxpages = %d\n", kz.uk_maxpages);
 
-		printf("  uk_slabsize = %d\n", kz.uk_slabsize);
 		printf("  uk_pgoff = %d\n", kz.uk_pgoff);
 		printf("  uk_ppera = %d\n", kz.uk_ppera);
 		printf("  uk_ipers = %d\n", kz.uk_ipers);



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