From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1BECC433E1 for ; Wed, 19 Aug 2020 02:29:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B70D205CB for ; Wed, 19 Aug 2020 02:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgHSC3T (ORCPT ); Tue, 18 Aug 2020 22:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbgHSC3T (ORCPT ); Tue, 18 Aug 2020 22:29:19 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D12E3C061389; Tue, 18 Aug 2020 19:29:18 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8Dqd-000c0L-B6; Wed, 19 Aug 2020 02:29:07 +0000 Date: Wed, 19 Aug 2020 03:29:07 +0100 From: Al Viro To: Linus Torvalds Cc: Miklos Szeredi , Steven Whitehouse , David Howells , linux-fsdevel , Karel Zak , Jeff Layton , Miklos Szeredi , Nicolas Dichtel , Christian Brauner , Lennart Poettering , Linux API , Ian Kent , LSM , Linux Kernel Mailing List Subject: Re: file metadata via fs API Message-ID: <20200819022907.GE1236603@ZenIV.linux.org.uk> References: <52483.1597190733@warthog.procyon.org.uk> <066f9aaf-ee97-46db-022f-5d007f9e6edb@redhat.com> <94f907f0-996e-0456-db8a-7823e2ef3d3f@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 11:51:25AM -0700, Linus Torvalds wrote: > I think people who have problems parsing plain ASCII text are just > wrong. It's not that expensive. The thing that makes /proc/mounts > expensive is not the individual lines - it's that there are a lot of > them. It is expensive - if you use strdup() all over the place, do asprintf() equivalents for concatenation, etc. IOW, you can write BASIC (or javascript) in any language... systemd used to be that bad - exactly in parsing /proc/mounts; I hadn't checked that code lately, so it's possible that it had gotten better, but about 4 years ago it had been awful. OTOH, at that time I'd been looking at the atrocities kernel-side (in fs/pnode.c), where on realistic setups we had O(N^2) allocations done, with all but O(N) of them ending up freed before anyone could see them. So it's not as if they had a monopoly on bloody awful code...