Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp837493pxy; Fri, 30 Apr 2021 18:28:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8ivR7R4v7514ZGgrHp1vU4cvHlr3fnkKCHlTTIB1sx5L3De9Jt0k0prz9wHuZgpifqDKI X-Received: by 2002:aa7:db87:: with SMTP id u7mr9047762edt.16.1619832495120; Fri, 30 Apr 2021 18:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619832495; cv=none; d=google.com; s=arc-20160816; b=s4G4fEcxtfyuFT4xVuRYLjCJA5NqaBa7991EkiBpH07xB1ISkv67JId6sF47SLUHfe Gf7V1edTgRaWn4YKnscLK5Kb+uXjaevp9i1IOqFSTB+MvrdQFZSf+VZ08Vs+WdiCa21M bK6LAePmyBAFmOZDxTiPv8VW1WCHLEhcVtLf6sgDO8oANhlLV5uOOHd/RrgSG3LZwHFY nrIDS7mzF4RlvNVSpNZXO1dpqZFlmX2BPjp/eAV3jdR0iXfZo3eZnsrmrK+Dy9EiHGEE yJ93DR1eKeWs5Noc8tTYe73UhaWEqgAicusCpJ1lpdfD3nbUOjfwCD8tFgQR68HRCu2H X8Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AYQ9Il+dA/pq2ZY5nJ7eyP52AYYn0pZLbsxAJBCe+mw=; b=ZcWdZXMeHlMh/PMyPW6OKko0jtliy36Cqb7TIdnmq0XmBR5oBnS+WkudVJrfHmOGJl vEmKvmc/1AzB8XAKDMjzOCVms3mwiW4J/dvniyLksHPAKrHVoDsXQHP8JeVdoY+9xY8b IuUKIxsFbkZGbG0BIY67ILw6a3kHiG685TNGGKJb7saQVgmj9e97VQKt9ozwyC9AEZDY 04V6jRdtUJv4fhpLtcy7YZI8dE2uTEJ0N0Fm+QvUCIHCnFQk4hDvcgjUAzI/ZNE4Tqi7 pPiPIF08ZF8UE4Qd3O6uIpQQcLqOLc030u9+XxIRoqSGGMtxX7aRXeDz6RkEOGrgAukI 1cQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cWa96zKJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si325114edy.298.2021.04.30.18.27.31; Fri, 30 Apr 2021 18:28:15 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cWa96zKJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbhEABXh (ORCPT + 99 others); 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-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