From owner-freebsd-hackers@freebsd.org Mon May 20 16:54:49 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3859E15B3006 for ; Mon, 20 May 2019 16:54:49 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3678787947; Mon, 20 May 2019 16:54:48 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1hSlYk-0001Cz-MH; Mon, 20 May 2019 19:54:46 +0300 Date: Mon, 20 May 2019 19:54:46 +0300 From: Slawa Olhovchenkov To: Mark Johnston Cc: freebsd-hackers@freebsd.org Subject: Re: Commit r345200 (new ARC reclamation threads) looks suspicious to me - second potential problem Message-ID: <20190520165446.GC47119@zxy.spb.ru> References: <369cb1e9-f36a-a558-6941-23b9b811825a@FreeBSD.org> <20190520164202.GA2130@spy> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190520164202.GA2130@spy> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: 3678787947 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.34 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.87)[0.874,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[zxy.spb.ru]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.79)[0.792,0]; IP_SCORE(0.00)[country: RU(0.01)]; MX_GOOD(-0.01)[cached: zxy.spb.ru]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_LONG(0.78)[0.785,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5495, ipnet:195.70.192.0/19, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 16:54:49 -0000 On Mon, May 20, 2019 at 12:42:10PM -0400, Mark Johnston wrote: > On Mon, May 20, 2019 at 07:05:07PM +0300, Lev Serebryakov wrote: > > > > I'm looking at last commit to > > 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c' (r345200) and > > have another question. > > > > Here are such code: > > > > 4960 /* > > 4961 * Kick off asynchronous kmem_reap()'s of all our caches. > > 4962 */ > > 4963 arc_kmem_reap_soon(); > > 4964 > > 4965 /* > > 4966 * Wait at least arc_kmem_cache_reap_retry_ms between > > 4967 * arc_kmem_reap_soon() calls. Without this check it is > > possible to > > 4968 * end up in a situation where we spend lots of time reaping > > 4969 * caches, while we're near arc_c_min. Waiting here also > > gives the > > 4970 * subsequent free memory check a chance of finding that the > > 4971 * asynchronous reap has already freed enough memory, and > > we don't > > 4972 * need to call arc_reduce_target_size(). > > 4973 */ > > 4974 delay((hz * arc_kmem_cache_reap_retry_ms + 999) / 1000); > > 4975 > > > > But looks like `arc_kmem_reap_soon()` is synchronous on FreeBSD! So, > > this `delay()` looks very wrong. Am I right? > > > > Looks like it should be `#ifdef illumos`. > > See also r338142, which I believe was reverted by the update. Some throttling realy need for reducing ARC size (and for reap calls too, and this is not equal) (memory freeing to kernel-wide is too expensive and can realy take seconds and more), but this implementation for FreeBSD is too bad.