From owner-svn-src-all@freebsd.org Tue Aug 11 12:21:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E4799F735; Tue, 11 Aug 2015 12:21:43 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD51BB1D; Tue, 11 Aug 2015 12:21:42 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wicja10 with SMTP id ja10so66476046wic.1; Tue, 11 Aug 2015 05:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=vO3bSCUqVfXEAaKpNtD66JM8ZJzZRApgR5BzaG8bUYA=; b=iPPqiUYoqHoPWRSBIMfi9J00uAAPU3pE1XICRIcL14K5V1Z/0wOTETC3ubF5uvCCnC DDeY4vKI8EJCaSGIjHTTBtPz/jhxRfTccto/qBGaUaIz9nK2eUFgtNCat3eZQAWiT4SP i+142Xd7ihG6iRbnnrWlxPzmmTfbx5WvlWkM+webJ3d3crF8R3o3vWDw5/I0TfMr1pox eCyBahEYqs5MEOMg76c405oTZDEfRjXXGov2Objy/4TXbmBgLt6jwGHqi2r9RMXDjF3y wyS4aZcbWVb7gMBdbedO+LobNPlRo4opv6C8WlacOmFFpsIkFAvihEf0HZ4MA690yIUc z8CA== X-Received: by 10.194.172.233 with SMTP id bf9mr55707910wjc.107.1439295700709; Tue, 11 Aug 2015 05:21:40 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id s1sm3164832wix.13.2015.08.11.05.21.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 05:21:39 -0700 (PDT) Sender: Baptiste Daroussin Date: Tue, 11 Aug 2015 14:21:37 +0200 From: Baptiste Daroussin To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286625 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20150811122137.GI96980@ivaldir.etoilebsd.net> References: <201508111039.t7BAdK1x071658@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="81JctsDUVPekGcy+" Content-Disposition: inline In-Reply-To: <201508111039.t7BAdK1x071658@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 12:21:43 -0000 --81JctsDUVPekGcy+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 11, 2015 at 10:39:20AM +0000, Alexander Motin wrote: > Author: mav > Date: Tue Aug 11 10:39:19 2015 > New Revision: 286625 > URL: https://svnweb.freebsd.org/changeset/base/286625 >=20 > Log: > MFV r277425: > 5376 arc_kmem_reap_now() should not result in clearing arc_no_grow > Reviewed by: Christopher Siden > Reviewed by: George Wilson > Reviewed by: Steven Hartland > Reviewed by: Richard Elling > Approved by: Dan McDonald > Author: Matthew Ahrens > =20 > illumos/illumos-gate@2ec99e3e987d8aa273f1e9ba2b983557d058198c >=20 > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c >=20 > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 11 = 09:26:11 2015 (r286624) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 11 = 10:39:19 2015 (r286625) > @@ -153,13 +153,7 @@ static kmutex_t arc_reclaim_thr_lock; > static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ > static uint8_t arc_thread_exit; > =20 > -#define ARC_REDUCE_DNLC_PERCENT 3 > -uint_t arc_reduce_dnlc_percent =3D ARC_REDUCE_DNLC_PERCENT; > - > -typedef enum arc_reclaim_strategy { > - ARC_RECLAIM_AGGR, /* Aggressive reclaim strategy */ > - ARC_RECLAIM_CONS /* Conservative reclaim strategy */ > -} arc_reclaim_strategy_t; > +uint_t arc_reduce_dnlc_percent =3D 3; > =20 > /* > * The number of iterations through arc_evict_*() before we > @@ -174,7 +168,19 @@ static int arc_grow_retry =3D 60; > static int arc_p_min_shift =3D 4; > =20 > /* log2(fraction of arc to reclaim) */ > -static int arc_shrink_shift =3D 5; > +static int arc_shrink_shift =3D 7; > + > +/* > + * log2(fraction of ARC which must be free to allow growing). > + * I.e. If there is less than arc_c >> arc_no_grow_shift free memory, > + * when reading a new block into the ARC, we will evict an equal-sized b= lock > + * from the ARC. > + * > + * This must be less than arc_shrink_shift, so that when we shrink the A= RC, > + * we will still not allow it to grow. > + */ > +int arc_no_grow_shift =3D 5; > + > =20 > /* > * minimum lifespan of a prefetch block in clock ticks > @@ -3055,13 +3061,10 @@ arc_flush(spa_t *spa) > } > =20 > void > -arc_shrink(void) > +arc_shrink(int64_t to_free) > { > =20 > if (arc_c > arc_c_min) { > - uint64_t to_free; > - > - to_free =3D arc_c >> arc_shrink_shift; > DTRACE_PROBE4(arc__shrink, uint64_t, arc_c, uint64_t, > arc_c_min, uint64_t, arc_p, uint64_t, to_free); > if (arc_c > arc_c_min + to_free) > @@ -3089,44 +3092,76 @@ arc_shrink(void) > } > } > =20 > -static int needfree =3D 0; > +static long needfree =3D 0; > =20 > -static int > -arc_reclaim_needed(void) > +typedef enum free_memory_reason_t { > + FMR_UNKNOWN, > + FMR_NEEDFREE, > + FMR_LOTSFREE, > + FMR_SWAPFS_MINFREE, > + FMR_PAGES_PP_MAXIMUM, > + FMR_HEAP_ARENA, > + FMR_ZIO_ARENA, > + FMR_ZIO_FRAG, > +} free_memory_reason_t; > + > +int64_t last_free_memory; > +free_memory_reason_t last_free_reason; > + > +/* > + * Additional reserve of pages for pp_reserve. > + */ > +int64_t arc_pages_pp_reserve =3D 64; > + > +/* > + * Additional reserve of pages for swapfs. > + */ > +int64_t arc_swapfs_reserve =3D 64; > + > +/* > + * Return the amount of memory that can be consumed before reclaim will = be > + * needed. Positive if there is sufficient free memory, negative indica= tes > + * the amount of memory that needs to be freed up. > + */ > +static int64_t > +arc_available_memory(void) > { > + int64_t lowest =3D INT64_MAX; > + int64_t n; > + free_memory_reason_t r =3D FMR_UNKNOWN; > =20 > #ifdef _KERNEL > - > - if (needfree) { > - DTRACE_PROBE(arc__reclaim_needfree); > - return (1); > + if (needfree > 0) { > + n =3D PAGESIZE * (-needfree); > + if (n < lowest) { > + lowest =3D n; > + r =3D FMR_NEEDFREE; > + } > } > =20 > /* > * Cooperate with pagedaemon when it's time for it to scan > * and reclaim some pages. > */ > - if (freemem < zfs_arc_free_target) { > - DTRACE_PROBE2(arc__reclaim_freemem, uint64_t, > - freemem, uint64_t, zfs_arc_free_target); > - return (1); > + n =3D PAGESIZE * (int64_t)(freemem - zfs_arc_free_target); > + if (n < lowest) { > + lowest =3D n; > + r =3D FMR_LOTSFREE; > } > =20 > #ifdef illumos > /* > - * take 'desfree' extra pages, so we reclaim sooner, rather than later > - */ > - extra =3D desfree; > - > - /* > * check that we're out of range of the pageout scanner. It starts to > * schedule paging if freemem is less than lotsfree and needfree. > * lotsfree is the high-water mark for pageout, and needfree is the > * number of needed free pages. We add extra pages here to make sure > * the scanner doesn't start up while we're freeing memory. > */ > - if (freemem < lotsfree + needfree + extra) > - return (1); > + n =3D PAGESIZE * (freemem - lotsfree - needfree - desfree); > + if (n < lowest) { > + lowest =3D n; > + r =3D FMR_LOTSFREE; > + } > =20 > /* > * check to make sure that swapfs has enough space so that anon > @@ -3135,8 +3170,13 @@ arc_reclaim_needed(void) > * swap pages. We also add a bit of extra here just to prevent > * circumstances from getting really dire. > */ > - if (availrmem < swapfs_minfree + swapfs_reserve + extra) > - return (1); > + n =3D PAGESIZE * (availrmem - swapfs_minfree - swapfs_reserve - > + desfree - arc_swapfs_reserve); > + if (n < lowest) { > + lowest =3D n; > + r =3D FMR_SWAPFS_MINFREE; > + } > + > =20 > /* > * Check that we have enough availrmem that memory locking (e.g., via > @@ -3145,8 +3185,12 @@ arc_reclaim_needed(void) > * drops below pages_pp_maximum, page locking mechanisms such as > * page_pp_lock() will fail.) > */ > - if (availrmem <=3D pages_pp_maximum) > - return (1); > + n =3D PAGESIZE * (availrmem - pages_pp_maximum - > + arc_pages_pp_reserve); > + if (n < lowest) { > + lowest =3D n; > + r =3D FMR_PAGES_PP_MAXIMUM; > + } > =20 > #endif /* illumos */ > #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) > @@ -3161,12 +3205,11 @@ arc_reclaim_needed(void) > * heap is allocated. (Or, in the calculation, if less than 1/4th is > * free) > */ > - if (vmem_size(heap_arena, VMEM_FREE) < > - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2)) { > - DTRACE_PROBE2(arc__reclaim_used, uint64_t, > - vmem_size(heap_arena, VMEM_FREE), uint64_t, > - (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC)) >> 2); > - return (1); > + n =3D vmem_size(heap_arena, VMEM_FREE) - > + (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2) Missing a ';' here Best regards, Bapt --81JctsDUVPekGcy+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlXJ6NEACgkQ8kTtMUmk6Ey2kwCggjPXwGjvElzuHhgVCcEWn26l BIAAn3F49yU/aFnQ8V/gV8PS/X0kbzCM =CV17 -----END PGP SIGNATURE----- --81JctsDUVPekGcy+--