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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 400E7C433B4 for ; Sat, 1 May 2021 01:32:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CF0B61090 for ; Sat, 1 May 2021 01:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbhEABXh (ORCPT ); Fri, 30 Apr 2021 21:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbhEABXg (ORCPT ); Fri, 30 Apr 2021 21:23:36 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B8D7C06174A for ; Fri, 30 Apr 2021 18:22:47 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 12so112498053lfq.13 for ; Fri, 30 Apr 2021 18:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AYQ9Il+dA/pq2ZY5nJ7eyP52AYYn0pZLbsxAJBCe+mw=; b=cWa96zKJSn/iv11BQQ85n+L5O6NSSLrS/x4DnwB4QnZGc2VleTsOV+GzzeiyILVulW dqsQTIGaohhzpoupQQpDsyRxUPXu4Mzv/NoilAB+OJCOCWYzm+FJxWM26b7kGfiQBtWu JNiOxboSIimSA5d1tKM0uRpO+/861n7M5g61E= 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=AYQ9Il+dA/pq2ZY5nJ7eyP52AYYn0pZLbsxAJBCe+mw=; b=GKjkUifEa0NvyhClrk9aB3TDUAULiu80TnotoZRpZisSl/B2xzfzqOrShXW/H4Ua9X uwVcO5cC75GN0QY1MIOv6kbEuJprSUkPh8giEiqUWC5Po5AVDE9ScXixAR8oKl1X95MK o0Z8iHfqJP6kLQFnEfxG+OnG6ddnVsqsphUe+XPlWNv8n0iv8XtIbONL4okJ3oBd32NJ aSzLrMXXwvEc/VyxiXTPpEiLII0wzl5ZmIHfBL3qkCAbQbTpaluyboONcVhOtnIOfgx8 ELNT5VL6Ir2H0pYDJLfh0c/3aiSrwzFX1nJ3NfdWygCKlbMF/kLdVEw/M57s/Aw4nFH6 vjgg== X-Gm-Message-State: AOAM533jSpLLkgMCxzveMgjgdTbtN3Iazhnhgn6HGORrTojZYECk4Z/h bTmHCaAfPCMbWhgFaqlZNPXjr40HCB5MbTGq X-Google-Smtp-Source: ABdhPJxpB+cB13J8TXUEDH9HXcwRaKp0sWX/OKZwHf9JTzlAhYhwQ6K0xiny7WRZ8w7fP8rGgfCukg== X-Received: by 2002:a19:e015:: with SMTP id x21mr5323306lfg.390.1619832165850; Fri, 30 Apr 2021 18:22:45 -0700 (PDT) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id n13sm433219lfa.209.2021.04.30.18.22.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Apr 2021 18:22:45 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id s9so334573ljj.6 for ; Fri, 30 Apr 2021 18:22:45 -0700 (PDT) X-Received: by 2002:a2e:b555:: with SMTP id a21mr5593886ljn.507.1619832164814; Fri, 30 Apr 2021 18:22:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Fri, 30 Apr 2021 18:22:28 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Very slow clang kernel config .. To: Nick Desaulniers Cc: Masahiro Yamada , Nathan Chancellor , Linux Kernel Mailing List , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 30, 2021 at 5:25 PM Nick Desaulniers wrote: > > Ah, no, sorry, these are the runtime link editor/loader. So probably > spending quite some time resolving symbols in large binaries. Yeah. Appended is the profile I see when I profile that "make oldconfig", so about 45% of all time seems to be spent in just symbol lookup and relocation. And a fair amount of time just creating and tearing down that huge executable (with a lot of copy-on-write overhead too), with the kernel side of that being another 15%. The cost of that is likely also fairly directly linked to all the dynamic linking costs, which brings in all that data. Just to compare, btw, this is the symbol lookup overhead for the gcc case: 1.43% ld-2.33.so do_lookup_x 0.96% ld-2.33.so _dl_relocate_object 0.69% ld-2.33.so _dl_lookup_symbol_x so it really does seem to be something very odd going on with the clang binary. Maybe the Fedora binary is built some odd way, but it's likely just the default clang build. Linus ---- 23.59% ld-2.33.so _dl_lookup_symbol_x 11.41% ld-2.33.so _dl_relocate_object 9.95% ld-2.33.so do_lookup_x 4.00% [kernel.vmlinux] copy_page 3.98% [kernel.vmlinux] next_uptodate_page 3.05% [kernel.vmlinux] zap_pte_range 1.81% [kernel.vmlinux] clear_page_rep 1.68% [kernel.vmlinux] asm_exc_page_fault 1.33% ld-2.33.so strcmp 1.33% ld-2.33.so check_match 0.92% libLLVM-12.so llvm::StringMapImpl::LookupBucketFor 0.83% [kernel.vmlinux] rmqueue_bulk 0.77% conf yylex 0.75% libc-2.33.so __gconv_transform_utf8_internal 0.74% libc-2.33.so _int_malloc 0.69% libc-2.33.so __strlen_avx2 0.62% [kernel.vmlinux] pagecache_get_page 0.58% [kernel.vmlinux] page_remove_rmap 0.56% [kernel.vmlinux] __handle_mm_fault 0.54% [kernel.vmlinux] filemap_map_pages 0.54% libc-2.33.so __strcmp_avx2 0.54% [kernel.vmlinux] __free_one_page 0.52% [kernel.vmlinux] release_pages