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