Date: Sat, 11 Mar 2017 16:43:38 +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: r315078 - head/sys/vm Message-ID: <201703111643.v2BGhcAt049735@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Sat Mar 11 16:43:38 2017 New Revision: 315078 URL: https://svnweb.freebsd.org/changeset/base/315078 Log: uma: fix pages <-> items conversions at several places Those places were not taking into account uk_ppera. At present one allocation is always used by one slab, so uk_ppera must be used to convert between pages and slabs. uk_ipers is used to convert between slabs and items. MFC after: 1 month (if ever) Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Mar 11 16:35:36 2017 (r315077) +++ head/sys/vm/uma_core.c Sat Mar 11 16:43:38 2017 (r315078) @@ -1505,7 +1505,8 @@ keg_ctor(void *mem, int size, void *udat printf("UMA: %s(%p) size %d(%d) flags %#x ipers %d ppera %d out %d free %d\n", zone->uz_name, zone, keg->uk_size, keg->uk_rsize, keg->uk_flags, keg->uk_ipers, keg->uk_ppera, - (keg->uk_ipers * keg->uk_pages) - keg->uk_free, keg->uk_free); + (keg->uk_pages / keg->uk_ppera) * keg->uk_ipers - keg->uk_free, + keg->uk_free); #endif LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); @@ -2916,7 +2917,7 @@ uma_zone_set_max(uma_zone_t zone, int ni keg->uk_maxpages = (nitems / keg->uk_ipers) * keg->uk_ppera; if (keg->uk_maxpages * keg->uk_ipers < nitems) keg->uk_maxpages += keg->uk_ppera; - nitems = keg->uk_maxpages * keg->uk_ipers; + nitems = (keg->uk_maxpages / keg->uk_ppera) * keg->uk_ipers; KEG_UNLOCK(keg); return (nitems); @@ -2933,7 +2934,7 @@ uma_zone_get_max(uma_zone_t zone) if (keg == NULL) return (0); KEG_LOCK(keg); - nitems = keg->uk_maxpages * keg->uk_ipers; + nitems = (keg->uk_maxpages / keg->uk_ppera) * keg->uk_ipers; KEG_UNLOCK(keg); return (nitems); @@ -3094,13 +3095,14 @@ uma_zone_reserve_kva(uma_zone_t zone, in if (pages * keg->uk_ipers < count) pages++; + pages *= keg->uk_ppera; #ifdef UMA_MD_SMALL_ALLOC if (keg->uk_ppera > 1) { #else if (1) { #endif - kva = kva_alloc((vm_size_t)pages * UMA_SLAB_SIZE); + kva = kva_alloc((vm_size_t)pages * PAGE_SIZE); if (kva == 0) return (0); } else @@ -3300,8 +3302,8 @@ uma_print_keg(uma_keg_t keg) "out %d free %d limit %d\n", keg->uk_name, keg, keg->uk_size, keg->uk_rsize, keg->uk_flags, keg->uk_ipers, keg->uk_ppera, - (keg->uk_ipers * keg->uk_pages) - keg->uk_free, keg->uk_free, - (keg->uk_maxpages / keg->uk_ppera) * keg->uk_ipers); + (keg->uk_pages / keg->uk_ppera) * keg->uk_ipers - keg->uk_free, + keg->uk_free, (keg->uk_maxpages / keg->uk_ppera) * keg->uk_ipers); printf("Part slabs:\n"); LIST_FOREACH(slab, &keg->uk_part_slab, us_link) slab_print(slab);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703111643.v2BGhcAt049735>