Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp342937imj; Sat, 16 Feb 2019 01:27:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IanSTDeS7xZA7RD16UNI4Lh01baVHqtpIUnQImZmhRqIKmYmNKWurP7oi7FQ1r9SGIZpz/G X-Received: by 2002:a62:33c1:: with SMTP id z184mr13983783pfz.104.1550309241437; Sat, 16 Feb 2019 01:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550309241; cv=none; d=google.com; s=arc-20160816; b=fF2kMaFZkiaKOCdzi52K0vlo11+SnYfwyRUvHlckrMdpUSOt6zn3Uaul9FJQUALz0T Kmm4/qOT6ddsZAYb8MlJXXfmMnpmOMh/qrCSR34Vzi9lQzUBnFAi0FKh5Yq/LatuFzbz G39PERHUPdf0nJ0RGQQWcDhHKtA/kG0wsHx0adRr1H7wALggRTnDYNN/3/RSHHZB2BvE pSCe5YiL/vj3V3YegfuxdzFBmGGEOnDDZ6aF5aQVPSHSkMmeT2W5BXt0HONkvIoWVOOo nH/I41JmjxNTJeOdJaxo+6IAjphKkT6V7q/zjHlO9x0BtwS0TROroxJRR/bNOi+RPzwB rMmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Kd35ZHva21s7+LruR0Uow9nyUoPHOpadUErTK7Y71dc=; b=C+ni/NCqWQGEn35eFHp6rF38kXHFWAfw7RdKToTE1+HWsNiipxN4ytiVIlKmN/mOUO x9Aq04iGJXkhS4E2uPHNqguCG6j80YWhEzFMaloste2CKniyy95PWANYGsVOBaDQKPP4 tNkr/SsKFrD3lM62RjEbtGLTgPBv6dFUsnOnSST+MeSYyIZagBWipcskrohYAbkZgz1l SwudDDHgeirpCYU51hSvquLCYdDg5t+Qbr24elAn2zatHR2ezmSy6eAN5I2qM5tnbUQ3 cNAE12DkqB46Dj0r8HZnNeuyfveOWdQzote4JBnpLLQJZH8OnGGGJ1IWKVy0rySC+DaH T4pA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n30si7335381pgb.406.2019.02.16.01.27.05; Sat, 16 Feb 2019 01:27:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394204AbfBOWzY (ORCPT + 99 others); Fri, 15 Feb 2019 17:55:24 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:46000 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393015AbfBOWzY (ORCPT ); Fri, 15 Feb 2019 17:55:24 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id F267D80454; Fri, 15 Feb 2019 23:55:14 +0100 (CET) Date: Fri, 15 Feb 2019 23:55:21 +0100 From: Pavel Machek To: "Richard W.M. Jones" Cc: kernel list , Andrew Morton , Wouter Verhelst , nbd@other.debian.org Subject: Re: nbd, nbdkit, loopback mounts and memory management Message-ID: <20190215225520.GA21165@amd> References: <20190215191953.GB17897@amd> <20190215224126.GX12500@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <20190215224126.GX12500@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2019-02-15 22:41:26, Richard W.M. Jones wrote: > On Fri, Feb 15, 2019 at 08:19:54PM +0100, Pavel Machek wrote: > > Hi! > >=20 > > I watched fosdem talk about > > nbdkit... https://www.youtube.com/watch?v=3D9E5A608xJG0 . Nice. But word > > of warning: I'm not sure using it read-write on localhost is safe. > >=20 > > In particular, user application could create a lot of dirty data > > quickly. If there's not enough memory for nbdkit (or nbd-client or > > nbd-server), you might get a deadlock. >=20 > Thanks for the kind words about the talk. I've added Wouter Verhelst > & the NBD mailing list to CC. Although I did the talk because the > subject is interesting, how I actually use nbdkit / NBD is to talk to > qemu and that's where I have most experience and where we (Red Hat) > use it in production systems. >=20 > However in January I spent a lot of time exercising the NBD loop-mount > + nbdkit case using fio in order to find contention / bottlenecks in > our use of threads and locks. I didn't notice any particular problems > then, but it's possible my testing wasn't thorough enough. Or that > fio only creates small numbers of dirty pages (because of locality in > its access patterns I guess?) >=20 > When you say it's not safe, what could happen? What would we observe > if it was going wrong? I'm not saying I've seen it happen, or have a test. But my understanding of memory management says it could deadlock... if nbd tried allocating memory while memory was "full" of dirty data. Dunno, something like ... take 1GB block device with 1GB RAM machine. Create memory pressure so that nbdkit (etc) is dropped from memory. Then quickly make all the data on the block device dirty. I believe that scenario is something that can not happen on system without NBD in loopback configuration. Situation may be made worse if nbdkit needs to allocate memory due for compression buffers or something like that. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlxnQ1gACgkQMOfwapXb+vKLzACdHOcDBVY5chhH+UTwSdTqjeWM XfoAnRH0/ItGERddhiTijzSImaorfOVE =B76J -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ--