Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp693234pxa; Wed, 5 Aug 2020 10:27:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwb6Lvxr235eiTZbyHs3mVT/5yCHc0oHWvXdj74Y3qN04N8mFyFrVTuzJrYBO4wSwH8utg X-Received: by 2002:a50:ef0a:: with SMTP id m10mr342146eds.226.1596648466708; Wed, 05 Aug 2020 10:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596648466; cv=none; d=google.com; s=arc-20160816; b=OMyBVs6b1LkHAIk8o8q61OWMOGdFBMpvzMw+QloZujL+5NCxPSsYGanq1K3U3XmgDE dOi1So2uKFB0rGew81GGnWv1HmTrjqcnzXAYSPyzVcfQ9c8Gaj2sWLcL9wHBvgg57IvR JjA6ce+oH8daFjsV4D0ZnEQ29aj1mtawwgUoNANhfkC+rz2lp86wWrZKZbElr22THsMU 2ZAjoTz5IwMkyUzB0JssRys0q3RKP23SLYb7zluEgm1cIzVDDog5oExUTmLBSODwVSVE CbRyJlcGm4Flif4awVk+5CRJuO+6zkmJmwZYr/djtniLED1c7Mu1weDvgMalMX4Wzlc7 cHYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PfhfFAEDblzsRQWrMzcI0diRWe/CNXK92mcngQaYd7Q=; b=mw4uo2JO12aCGJ9gMsY1EtJh16C+jKD5lmrgA4JjJqy2gjZFgwLlJ85PYw0l+l6GVC +aSzyjW3uZVLaMR618coUnC3BYPudV1WoBpiaq9GYJsBWItHVFRsdUn7TrMejYYRcv/t R1nFlHfw4Xzy+OyGXv/fQvEMpORaj2lEqt41boVOhmXS6pK4GxNsLj7BdRW39064vi6y dslgZVICtZdVhQNvQKeVW1EX5mqvz6e/N3a1M7dMw52+2m41RDZoR+WsiYych1nI155+ QyDmKorjyGntFgi87tD+A/KcclInEKlE+aBWgwziQghKx/tq2acwtjIRcxiC5vKP8v8q OAzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=H+qsmC3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si1569364ejv.502.2020.08.05.10.27.10; Wed, 05 Aug 2020 10:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=H+qsmC3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728519AbgHER0l (ORCPT + 99 others); Wed, 5 Aug 2020 13:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728474AbgHER0S (ORCPT ); Wed, 5 Aug 2020 13:26:18 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97508C061575 for ; Wed, 5 Aug 2020 10:26:18 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id o18so47241840eje.7 for ; Wed, 05 Aug 2020 10:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PfhfFAEDblzsRQWrMzcI0diRWe/CNXK92mcngQaYd7Q=; b=H+qsmC3Z3MgedQ/Jm+u3qVYeVXWyqQH33iCIHKK2tbGxBQbr38frgchQxuf3EzgvmP MNh03Ji3AV40eKkq2AvkoWr7v+NFfyOdrJJ5S474gQ999/lCCin015tia0j+ezaTWqZV /DOijvZvYoY+sBt3AM+Ygy+/Povj5zubYWXtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PfhfFAEDblzsRQWrMzcI0diRWe/CNXK92mcngQaYd7Q=; b=eHOiryEx28VwhKRWw8GnVkb5G5acKl2w2CydCwy4RAaJ6yB/pvlp6rE8k3bmS0xC2/ kMek9QOzfm4HqBY59jxmUt2k3cgA1wBv0vs/h2D0Et5E4bUq4RPzRNCfe6ABzSyqqcwt 0/gU7pe+a2WngWcQDGvmsODGzMJxifz7psQAG9PWHCJ2+0jp1xlaoDZ059MICdHTLchL 5uXRVJxRZUb/C5QU2/PYbK6Vo+MmAKw+0VsEZSmWT5reUKJ5xF6LbkuYiXEba9erU25Q guJAOdbKGbTZgNpO9KMAl8LeGrmN28W3vzm/55EKL6czc0kCj7cwrTly6SAeVvXe6PRm jXXw== X-Gm-Message-State: AOAM5313p1vPOQfywfr1vWDOj1y2roEBFpodiC3mhrIar5IOfOOm4tnd zZ1kbFyhKYICAjtj6mkv+XHWCcNFFlZMFxwF06rKVA== X-Received: by 2002:a17:906:4c46:: with SMTP id d6mr379886ejw.14.1596648377290; Wed, 05 Aug 2020 10:26:17 -0700 (PDT) MIME-Version: 1.0 References: <159646178122.1784947.11705396571718464082.stgit@warthog.procyon.org.uk> <159646187082.1784947.4293611877413578847.stgit@warthog.procyon.org.uk> <20200804135641.GE32719@miu.piliscsaba.redhat.com> <2320582.1596643618@warthog.procyon.org.uk> In-Reply-To: <2320582.1596643618@warthog.procyon.org.uk> From: Miklos Szeredi Date: Wed, 5 Aug 2020 19:26:06 +0200 Message-ID: Subject: Re: [PATCH 10/18] fsinfo: Provide notification overrun handling support [ver #21] To: David Howells Cc: Al Viro , Linus Torvalds , Ian Kent , Miklos Szeredi , Christian Brauner , Jann Horn , "Darrick J. Wong" , Karel Zak , Jeff Layton , Linux API , linux-fsdevel@vger.kernel.org, LSM , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 5, 2020 at 6:07 PM David Howells wrote: > > Miklos Szeredi wrote: > > > Shoun't we just make sure that the likelyhood of overruns is low > > That's not necessarily easy. To avoid overruns you need a bigger buffer. The > buffer is preallocated from unswappable kernel space. Yes, you can increase > the size of the buffer, but it eats out of your pipe bufferage limit. > > Further, it's a *general* notifications queue, not just for a specific > purpose, but that means it might get connected to multiple sources, and doing > something like tearing down a container might generate enough notifications to > overrun the queue. > > > and if it happens, just reinitialize everthing from scratch (shouldn't be > > *that* expensive). > > If you then spend time reinitialising everything, you're increasing the > likelihood of racing with further events. Further, there multiple expenses: > firstly, you have to tear down and discard all the data that you've spent time > setting up; secondly, it takes time doing all this; thirdly, it takes cpu > cycles away from applications. > > The reason I put the event counters in there and made it so that fsinfo() > could read all the mounts in a subtree and their event counters in one go is > to make it faster for the user to find out what changed in the event that a > notification is lost. That's just overdesigning it, IMO. If the protocol is extensible (as you state) then the counters can be added as needed. And unless the above CPU cycle wastage is actually observed in practice, the whole thing is unnecessary. Thanks, Miklos