Date: Thu, 20 Oct 2016 23:10:27 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307693 - head/sys/vm Message-ID: <201610202310.u9KNAR1c040864@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Thu Oct 20 23:10:27 2016 New Revision: 307693 URL: https://svnweb.freebsd.org/changeset/base/307693 Log: Simplify keg_drain() a bit by using LIST_FOREACH_SAFE. MFC after: 1 week Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Thu Oct 20 23:08:40 2016 (r307692) +++ head/sys/vm/uma_core.c Thu Oct 20 23:10:27 2016 (r307693) @@ -845,8 +845,7 @@ static void keg_drain(uma_keg_t keg) { struct slabhead freeslabs = { 0 }; - uma_slab_t slab; - uma_slab_t n; + uma_slab_t slab, tmp; /* * We don't want to take pages from statically allocated kegs at this @@ -862,15 +861,10 @@ keg_drain(uma_keg_t keg) if (keg->uk_free == 0) goto finished; - slab = LIST_FIRST(&keg->uk_free_slab); - while (slab) { - n = LIST_NEXT(slab, us_link); - - /* We have no where to free these to */ - if (slab->us_flags & UMA_SLAB_BOOT) { - slab = n; + LIST_FOREACH_SAFE(slab, &keg->uk_free_slab, us_link, tmp) { + /* We have nowhere to free these to. */ + if (slab->us_flags & UMA_SLAB_BOOT) continue; - } LIST_REMOVE(slab, us_link); keg->uk_pages -= keg->uk_ppera; @@ -880,8 +874,6 @@ keg_drain(uma_keg_t keg) UMA_HASH_REMOVE(&keg->uk_hash, slab, slab->us_data); SLIST_INSERT_HEAD(&freeslabs, slab, us_hlink); - - slab = n; } finished: KEG_UNLOCK(keg);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610202310.u9KNAR1c040864>