Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp865907pja; Wed, 1 Apr 2020 10:04:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs230Nf1BcON3tcgTouJm1uKThTiyS20HSsZr20qLe2rI0FkbCQWb7Wyrz4LVfkwIuOATVf X-Received: by 2002:a4a:a64b:: with SMTP id j11mr17936199oom.59.1585760658885; Wed, 01 Apr 2020 10:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585760658; cv=none; d=google.com; s=arc-20160816; b=HAxxuwJvEjuVROURVymvSh8ZFIM/e5GK97Rw2Yt8q7WXOxx4LZFVEf+DJENTcQC1jt BPmLigbRJcoMRDR1O8gOuRhjHB1gX86Q5dcxOjAgi5jar7ZeCkujikztXSzo4RSTzOa7 tN+J6D4UIbKsWb0Wfo9b48Z+6kCehBA2SeeOPU5t/wMTNvjT0xvKE/FZB3Kupe+KzVwF liL6mlq4d86PRxliew6t0uIxa5BRoQ8kkH14Hw1W4N+QoHP/eUle9TybzPtiUEuk0bRJ iyc+glSOIyEipsPxg/h83U5T7c05eYDFe1T8bx1e/kOEr6gkMTgXyVBGQDQV2j4T+uZL WAPw== 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=bfLjzLeMWjfMsXUpfBMpZITQLNm0/s+5U4p6mPLkyx4=; b=CBBryhgU5pciN+w34dOkJeC8gocjxCXv5KqdLe1KQkj7bXQEhnNLcXWk8BcdNd7bto SG3lmQ3TA+MQ+2oojgA/8kaqM+WauQdYufsENz4C/nIVu1yo6uhcFVryo8Z+OuM2lpOn wR41eJ5H3FIPInDkyNZu8Yh3WISNphMQmmtzAfs3N3qFP6MHvjEBmBR8ZzrtoHeHSQao EbOc/M6C/syzwxsHesrRA07OTw8n7t3RUcQpSrpokV4d1PjZx68hqgH4p+Hhc5y88PNc Ty+6nGkqEbiiuXmvbFVrAPRrcB4Uvi/C3cuDo9Qra88mww4u4Jas8Rl7toVf4elwOAr1 Hurw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=PUPKOUBO; 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 z29si985371oog.56.2020.04.01.10.03.59; Wed, 01 Apr 2020 10:04:18 -0700 (PDT) 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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=PUPKOUBO; 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 S1732808AbgDAP0J (ORCPT + 99 others); Wed, 1 Apr 2020 11:26:09 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43445 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732769AbgDAP0I (ORCPT ); Wed, 1 Apr 2020 11:26:08 -0400 Received: by mail-ed1-f66.google.com with SMTP id bd14so341483edb.10 for ; Wed, 01 Apr 2020 08:26:06 -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=bfLjzLeMWjfMsXUpfBMpZITQLNm0/s+5U4p6mPLkyx4=; b=PUPKOUBO1PptuoeDS6EalNpVTD9SHcie5wEhMjj46aXzacsfDhGqOQTO3YBYuFiGgn /PF10eXlMZiXtqVYf8mt9Ad7bv2XiUJXFgKYpO7grbhvE3hU81vIiCLtf4L0aV9AEMBD MQovOW/WX/yzCbxqhsR3TmZHZYFQ0PiI7DSuc= 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=bfLjzLeMWjfMsXUpfBMpZITQLNm0/s+5U4p6mPLkyx4=; b=WjKOocqBKDKEBh3iWwv9Mo0zcs/tpRy3R4hTERoPiIcpQWHI0usR6TilIGjqNkKDSk aajpqDuAB4RfXP1WMN6ma0yuW97KzIXOsbx9288Rv/jn9gfEPEmQKekJrKP9ZuOvt5It z9DBrMgGhlhB68WKhKq/c7XwFsjVtjrcxLsBXvZ0CNgSSfMB5wBFTimnpYbjzz/2u0IG ZH3j2ZQ+mqEiUf826CzClzyuWtC0RGy4ojYI/gwbhN+cWVj9aEI86RYgfgZ3OZFlaKkF Jvda9QmBSL0RPAE77DmEZjUZ9LxNfOryxvBejZJ6B4f/gjQbi2ZUR43oLqW01LsRgVyB SMCQ== X-Gm-Message-State: ANhLgQ1rl4/CwLh14kMSW9gnmAylUDnGVasDm4iVq5WYlKhxQ8nRR0L9 cFS7gsTOnOkKAg0K5gM6LqXWRvxAZGZ9xJoxoY1irQ== X-Received: by 2002:aa7:d2cb:: with SMTP id k11mr21860746edr.128.1585754765844; Wed, 01 Apr 2020 08:26:05 -0700 (PDT) MIME-Version: 1.0 References: <20200330211700.g7evnuvvjenq3fzm@wittgenstein> <1445647.1585576702@warthog.procyon.org.uk> <2418286.1585691572@warthog.procyon.org.uk> <20200401090445.6t73dt7gz36bv4rh@ws.net.home> <2488530.1585749351@warthog.procyon.org.uk> <2488734.1585749502@warthog.procyon.org.uk> In-Reply-To: <2488734.1585749502@warthog.procyon.org.uk> From: Miklos Szeredi Date: Wed, 1 Apr 2020 17:25:54 +0200 Message-ID: Subject: Re: Upcoming: Notifications, FS notifications and fsinfo() To: David Howells Cc: Karel Zak , Christian Brauner , Linus Torvalds , Al Viro , dray@redhat.com, Miklos Szeredi , Steven Whitehouse , Jeff Layton , Ian Kent , andres@anarazel.de, keyrings@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Lennart Poettering , Aleksa Sarai Content-Type: multipart/mixed; boundary="00000000000085172a05a23c4d0d" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000085172a05a23c4d0d Content-Type: text/plain; charset="UTF-8" On Wed, Apr 1, 2020 at 3:58 PM David Howells wrote: > > David Howells wrote: > > > > Attached patch applies against readfile patch. > > > > But doesn't actually do what Karel asked for. show_mountinfo() itself does > > not give you what Karel asked for. Not sure what you mean. I think it shows precisely the information Karel asked for. > Plus there's more information you need to > > add to it. The mountinfo format is extensible (see Documentation/filesystems/proc.txt) so for example adding the change counters would be simple. > And arguably, it's worse than just reading /proc/mounts. If you get a > notification that something changed (ie. you poll /proc/mounts or mount > notifications gives you an overrun) you now have to read *every* > /mountfs/*/info file. That is way more expensive. fsinfo(2) will never be substantially cheaper than reading and parsing /mnt/MNT_ID/info. In fact reading a large part of the mount table using fsinfo(2) will be substantially slower than parsing /proc/self/mountinfo (this doesn't actually do the parsing but that would add a very small amount of overhead): root@kvm:~# ./test-fsinfo-perf /tmp/a 30000 --- make mounts --- --- test fsinfo by path --- sum(mnt_id) = 960000 --- test fsinfo by mnt_id --- sum(mnt_id) = 960000 --- test /proc/fdinfo --- sum(mnt_id) = 960000 --- test mountfs --- sum(mnt_id) = 960000 --- test mountinfo --- sum(mnt_id) = 960000 For 30000 mounts, f= 154963us f2= 148337us p= 1803699us p2= 257019us; m= 53996us; p=11.6*f p=12.2*f2 p=7.0*p2 p=33.4*m --- umount --- Yes, that's 33 times faster! Thanks, Miklos --00000000000085172a05a23c4d0d Content-Type: text/x-patch; charset="US-ASCII"; name="test-fsinfo-perf-mountinfo.patch" Content-Disposition: attachment; filename="test-fsinfo-perf-mountinfo.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k8hhddno0 LS0tCiBzYW1wbGVzL3Zmcy90ZXN0LWZzaW5mby1wZXJmLmMgfCAgIDkxICsrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKy0tCiAxIGZpbGUgY2hhbmdlZCwgODcgaW5zZXJ0aW9u cygrKSwgNCBkZWxldGlvbnMoLSkKCi0tLSBhL3NhbXBsZXMvdmZzL3Rlc3QtZnNpbmZvLXBlcmYu YworKysgYi9zYW1wbGVzL3Zmcy90ZXN0LWZzaW5mby1wZXJmLmMKQEAgLTMzOSw2ICszMzksNzkg QEAgc3RhdGljIHZvaWQgZ2V0X2lkX2J5X21vdW50ZnModm9pZCkKIAl9IHdoaWxlIChwID0gY29t bWEsICpjb21tYSk7CiB9CiAKK3N0YXRpYyB2b2lkIGdldF9pZF9ieV9tb3VudGluZm8odm9pZCkK K3sKKwl1bnNpZ25lZCBpbnQgYmFzZV9tbnRfaWQsIG1udF9pZCwgeDsKKwlzc2l6ZV90IGxlbjsK KwljaGFyIHByb2NmaWxlWzEwMF0sIGJ1ZmZlcls0MDk2XSwgKnAsICpubDsKKwlpbnQgZmQsIGZk MiwgbW50ZmQ7CisKKwkvKiBTdGFydCBvZmYgYnkgcmVhZGluZyB0aGUgbW91bnQgSUQgZnJvbSB0 aGUgYmFzZSBwYXRoICovCisJZmQgPSBvcGVuKGJhc2VfcGF0aCwgT19QQVRIKTsKKwlFUlIoZmQs ICJvcGVuL3BhdGgiKTsKKwlzcHJpbnRmKHByb2NmaWxlLCAiL3Byb2Mvc2VsZi9mZGluZm8vJXUi LCBmZCk7CisJZmQyID0gb3Blbihwcm9jZmlsZSwgT19SRE9OTFkpOworCUVSUihmZDIsICJvcGVu L3Byb2MiKTsKKwlsZW4gPSByZWFkKGZkMiwgYnVmZmVyLCBzaXplb2YoYnVmZmVyKSAtIDEpOwor CUVSUihsZW4sICJyZWFkIik7CisJYnVmZmVyW2xlbl0gPSA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