From owner-freebsd-fs@freebsd.org Mon Dec 2 22:54:30 2019 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9C7E1BB52A for ; Mon, 2 Dec 2019 22:54:30 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RgR92sVgz4WVX for ; Mon, 2 Dec 2019 22:54:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72b.google.com with SMTP id v23so1470351qkg.2 for ; Mon, 02 Dec 2019 14:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=RsXJYb88LHCvWCJzesynw/K27JrgCfAiPAdKpxbJXew=; b=MPfq213+Kf0l8VPeXvmxCFsiefFD6BIoJoAd5u2eIjWSvNUKi+h3AM33YawmwHFqae hU477Utb6GZd4FQ5kH06QVhqs5ithQYYWWKBVuDCy26SfC9FWQQJxAVDm+dF5+gTIpWK A+BVYd/9ZQjkoq+3CJp7KrtSMHluLyzzqvtNCH6yZRojpXBZ6SrJTSVwZOhwC8r1kvk1 3HwXGyQLGi6SqYe2e0S6v1ieNIOo7u6XxUqOg112CodZcTpwen4D8b+5zTDVUWp8BqPp xkx/b0VDjJ7dDIhkoRn4AKZG+4XCm6nWWHr0TdceqhO4ABThbRKUv+lMu4okKuycIRpv pdrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=RsXJYb88LHCvWCJzesynw/K27JrgCfAiPAdKpxbJXew=; b=gMmjKzev72fPmF+J75NXuKoIx1IXQtboObUIlSpKyhZJY66ySpLIEiGfV5Ckw50vw+ EWgoGl0QonIl6UfnmUP24SNAzBOT27ODpDjzEfLUN8W48WVVd65J49XHD61Rw5T1l2qI ORtOeChJuYaf7p6uGaNUdvC4XVVgjw+clpADg9SZ2XG4ui6xcfk8lmEhyIOi+CEWdKIS 7pZfo41SNA3V8NhdeTTBKq7GOAogkCqTk8IjdabC4DHFW0L+IWM5nXtawHJMsTwvkCio +7zMIVaa0BmYeetCK9yBYI1cUzS4A4McajiS38BNwX7K/RRyOs2XQCS0KbbJHPc4X6lm pioA== X-Gm-Message-State: APjAAAU4TKPbSkGWUsnIBulw8OmZuytP7kf5FRm9U2YTW5IhI/EWsYLu yNWeSuhvhNhNlPQEcEVy0gLip0CxLf8= X-Google-Smtp-Source: APXvYqwR/PF2IiaX0IBOkUhGtT17WWquYixCDNBK3J45fU8JMhlbCqUORb6BNfVLy83N6+id6Hk0ZA== X-Received: by 2002:a37:81c6:: with SMTP id c189mr1679653qkd.223.1575327268093; Mon, 02 Dec 2019 14:54:28 -0800 (PST) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id h28sm621893qte.54.2019.12.02.14.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 14:54:27 -0800 (PST) Sender: Mark Johnston Date: Mon, 2 Dec 2019 17:54:24 -0500 From: Mark Johnston To: Peter Eriksson Cc: freebsd-fs@freebsd.org Subject: Re: Slow reboots due to ZFS cleanup in kern_shutdown() .. zio_fini() Message-ID: <20191202225424.GG43802@raichu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47RgR92sVgz4WVX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=MPfq213+; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::72b as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-4.43 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[b.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.73)[ip: (-9.40), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.94), country: US(-0.05)]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:54:30 -0000 On Mon, Dec 02, 2019 at 11:39:01PM +0100, Peter Eriksson wrote: > Sigh. > > Slight correction, the output below should have said uma_zdestroy() and not uma_zfree_arg() (wrong printf text, but the right times). > > After an uptime of 7 hours, a reboot have these times (I removed the “uma” printf in this run): > > kmem_cache_destroy(zio_data_buf_cache[8]) took 2 seconds > kmem_cache_destroy(zio_buf_cache[10]) took 6 seconds > kmem_cache_destroy(zio_buf_cache[14]) took 2 seconds > kmem_cache_destroy(zio_buf_cache[16]) took 136 seconds > kmem_cache_destroy(zio_buf_cache[20]) took 31 seconds > kmem_cache_destroy(zio_buf_cache[28]) took 303 seconds > kmem_cache_destroy(zio_buf_cache[224]) took 89 seconds > kmem_cache_destroy(zio_data_buf_cache[224]) took 31 seconds > > This is on a mostly idle server (well, apart from compiling the kernel code :-) and some snapshots being taken of all filesystems (once per hour). > > > So now on to finding out why uma_destroy() is taking so long… :-). uma_destroy() frees all of the memory cached in the zone back to the page allocator. This operation takes time proportional to the number of cached items. I would expect most of the time to be spent in zone_reclaim(), called by zone_dtor(). Before rebooting, could you try grabbing the output of vmstat -z?