Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1415485pxy; Sat, 1 May 2021 12:59:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXkVMvbtQ9hEP5orEqYJeRNB1F5QvjA00XkEuU1w1PF3XPnWo06uzWncQCCUX5DgeWn99I X-Received: by 2002:a05:6a00:168d:b029:23f:376d:a2f8 with SMTP id k13-20020a056a00168db029023f376da2f8mr11094157pfc.20.1619899163188; Sat, 01 May 2021 12:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619899163; cv=none; d=google.com; s=arc-20160816; b=NCTo1UAGmXPPxkaiHFxz8np0XBOLVsh8TFvL3xUh+c5Ywj2sicUZmyVHKHiC2eXlOa L8eckCypHcV1OXQ/G4UmVxHRB4t7HIimmtnwK4B9OijxuNZMnxE3UubCtfW4th8H0OLU mSB8G/8Vq1FAuz3cXYQ2cnq6mzv4TteTeiJeQ8wAeOHE0t4JEsC1bYISQFDICspuVtzw dV52a9WNhDsdmwx1OF11fuG2MIX6Auh01ShizvHQn38E3og//HwdRtg6v+Bn1Ilh/9x3 9Yvmb1q4CSTLUElTZZqrrrwhzcX12KPqIVwNdKzTHAjBIz33kt9G6JppyWDEugwUs6JF QFfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=A9R4j7a8fI/3H7XHbWziyC6/tMo7wqo/k8KiwRI6ZK8=; b=W9yil+8rO28fdoBQLfG4oIbuUqMvyoF59eg/yiJiTrirpelmS+JT6U+f4Q9AK+ecTv dDbmHgWrEFgzKk/OpSjwndZiF3+W0+qy1tXHmJBztB5QNGqpt2Ju/E9TeXQmjEtjkyWD F4P4a6lEtbgLOmr9+zTPKcyAyCQpyonscU1mIJ0rAFoWWAGEDA7bD8/2DeUiW4WQRILx 5+VuyuY80O3rgNmD/CqMuJrRAgVZCZv4qPcdmEeTz1WnuayZWBV77lryKUqEZMEz/K/3 FId9b2zF7fcfRLUCZzOWN4kb2tmZVz0cZSrx/+mZFjOdTrAdMLeRVnVki4GsW7kpJqCh MjJA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si3905754plg.395.2021.05.01.12.59.10; Sat, 01 May 2021 12:59:23 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbhEAT7a (ORCPT + 99 others); Sat, 1 May 2021 15:59:30 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:41502 "EHLO smtp1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbhEAT7a (ORCPT ); Sat, 1 May 2021 15:59:30 -0400 Received: from localhost (unknown [88.164.140.197]) (Authenticated sender: sergesanspaille@free.fr) by smtp1-g21.free.fr (Postfix) with ESMTPSA id F011CB0052C; Sat, 1 May 2021 21:57:50 +0200 (CEST) Date: Sat, 1 May 2021 21:57:50 +0200 From: Serge Guelton To: Linus Torvalds Cc: Tom Stellard , Nick Desaulniers , Masahiro Yamada , Nathan Chancellor , Linux Kernel Mailing List , clang-built-linux , Fangrui Song , Sylvestre Ledru Subject: Re: Very slow clang kernel config .. Message-ID: <20210501195750.GA1480516@sguelton.remote.csb> References: <1c5e05fa-a246-9456-ff4e-287960acb18c@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 01, 2021 at 09:32:25AM -0700, Linus Torvalds wrote: > On Fri, Apr 30, 2021 at 8:33 PM Tom Stellard wrote: > > > > Yes, it's intentional. Dynamic linking libraries from other packages is > > the Fedora policy[1], and clang and llvm are separate packages (in Fedora). > > Side note: I really wish Fedora stopped doing that. > > Shared libraries are not a good thing in general. They add a lot of > overhead in this case, but more importantly they also add lots of > unnecessary dependencies and complexity, and almost no shared > libraries are actually version-safe, so it adds absolutely zero > upside. > > Yes, it can save on disk use, but unless it's some very core library > used by a lot of things (ie particularly things like GUI libraries > like gnome or Qt or similar), the disk savings are often not all that > big - and disk is cheap. And the memory savings are often actually > negative (again, unless it's some big library that is typically used > by lots of different programs at the same time). > > In this case, for example, it's true that a parallel build will be > running possibly hundreds of copies of clang at the same time - and > they'll all share the shared llvm library. But they'd share those same > pages even if it wasn't a shared library, because it's the same > executable! And the dynamic linking will actually cause a lot _less_ > sharing because of all the fixups. > > We hit this in the subsurface project too. We had a couple of > libraries that *nobody* else used. Literally *nobody*. But the Fedora > policy meant that a Fedora package had to go the extra mile to make > those other libraries be shared libraries, for actual negative gain, > and a much more fragile end result (since those libraries were in no > way compatible across different versions - so it all had to be updated > in lock-step). > > I think people have this incorrect picture that "shared libraries are > inherently good". They really really aren't. They cause a lot of > problems, and the advantage really should always be weighed against > those (big) disadvantages. > > Pretty much the only case shared libraries really make sense is for > truly standardized system libraries that are everywhere, and are part > of the base distro. > > [ Or, for those very rare programs that end up dynamically loading > rare modules at run-time - not at startup - because that's their > extension model. But that's a different kind of "shared library" > entirely, even if ELF makes the technical distinction between > "loadable module" and "shared library" be a somewhat moot point ] I tend to agree with most of these arguments, but let me offer another perspective: # from an llvm-repo, configured to use libLLVM.so > du -s bin 9152344 bin # from the same repo, configured to use static libraries > du -s bin 43777528 As a packager, I roughly need to put all these bits in packages, across base, development and debug package. As a user, I may need to download them. disk space is ok, but network bandwidth is not as cheap for everyone. Different metrics lead to different choice, then comes the great pleasure of making compromises :-) not