Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp570680rdb; Tue, 5 Dec 2023 13:14:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkLB8t0gS2c/hwl/mngykk1z9y7U5lsWQtPyIU8e9/t+RVTLODFwv0lo0UusR1jdUK9sBx X-Received: by 2002:a17:903:2442:b0:1d0:6ffd:e2c2 with SMTP id l2-20020a170903244200b001d06ffde2c2mr8163619pls.92.1701810892648; Tue, 05 Dec 2023 13:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701810892; cv=none; d=google.com; s=arc-20160816; b=ZeXMiwpaoZOjdy7Il67z3nDp1sYDEF/IstbyQUvm0dVd7ojqe9vl60fMJwUWSg4UvI Ip9kvNkMepKXTG417D7Y/8g7gsCndjgXlzEs6v1jEdSJKNapioSPO1EcNSmZr77/JdbG r37Oz5M212AzLqKVmRjeD6CKCoO4XAw60D2E/6pV4RXj/NIO964Pwr4egwLYFc6Ebvyi dIennK7OeFLJb/Q+exRkwjZhoG+iCOBohqP/ov98UclUESX9OhGTkjCKNJMZP9aHiUdJ KGMuwi1qN43Lp2qiIKJPekb8tYlsJekOqJ+bMS2xM0rnVusqSlstJAXlqjqadadbb5wz ONow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xb9GJhgKgkRI3jsH9IhBCRgWeg/UhW5Tj812rINOCFM=; fh=wyPa9jhyS/9S9G2ZZJIftNjklABAoq43Vo7AJkCc2nI=; b=mT4TkcynKSupH+eMTfYfA9yFdRIU78cxFxi1FO4sw1YTz1SYZkw7O/ye1ywnaCFuQ6 eOFXzafPVnnoZpRxJAQ0fCrYC1u54JwqU+Wnvx87DmqCRRuG7Pk9AAPIvPRBI4Szf1fh Q0WNgqN8hAV2qIFRuixStgpoedj9iF0fd3wKLRlOfqdLH+P8fPeK6d3d95aMOPSWgqbD ARdvHuL9ekRZyqKSHPrb5pxagM7NFXO8aI9ZscwtB21uLXjZoXgFMprTRimQb20lWIsY DBcLorHPn6dq6C8YPuFXRn1KMutHyMOeG+pUBAgjuwDk1FjKBn/kDdhVfqbPAwJTsEBf Bahw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zlEqBF2V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id g11-20020a170902934b00b001cfba7c561fsi9944870plp.249.2023.12.05.13.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 13:14:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zlEqBF2V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 221F28032A16; Tue, 5 Dec 2023 13:14:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbjLEVO1 (ORCPT + 99 others); Tue, 5 Dec 2023 16:14:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjLEVO0 (ORCPT ); Tue, 5 Dec 2023 16:14:26 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24957A5 for ; Tue, 5 Dec 2023 13:14:33 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40c0873cf84so35295665e9.1 for ; Tue, 05 Dec 2023 13:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701810871; x=1702415671; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xb9GJhgKgkRI3jsH9IhBCRgWeg/UhW5Tj812rINOCFM=; b=zlEqBF2VeXS1olvBg3qECJrst42Yf6eVHN92M8T5L+9tyfvFA0RcEIuol/wPMzAZbM t33JpTEiV5OIllwwc8iEuHeRqlsFsql3yIUgQtCbP6RWi9GiaGgiJ3foWnGfgIn/O1yK R3DJiXbHlCF7y/01Mg4CA/QgWPBPFfai5Qs5+eK8nzsC2tPPzZqPruBlrkuoJCDo50gF LuWbwm9ZKKP6zOpRiPKCC7TRSa3+E9D5xn8Gho68KlcqEVdyD+0TVDJpdDWXwchlf+2m m8Ku5UUTZtA4Oe41F4873DTlbid2Tk569yA38bt9nK270FOHt6dGg7NfAyM58EdIj7+c dm9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701810871; x=1702415671; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xb9GJhgKgkRI3jsH9IhBCRgWeg/UhW5Tj812rINOCFM=; b=QID3SrtFYXfoxFiDh/K1JnK1x5RifgDE+eOBbNlnLdVzjiejTlDkv9NGtRO3NPO1J2 hMkLDe9tSD/FSPVGCNmONmt0vOEKwrkUo8yRDcnIQw3UCgbAU+mT7x1zUAbby1Lcan9O dnDaSHw5KL4XfiVPTokaYCahzareCZ9nyBNU1ql39+UGRyiruMLz2dFs5KpzBDe41uYA wKKFQbRGMuK1Lmvc4XfgTz+pdzy1hw1xnDzYpoQT07OgUPcccu9iZAluO9wxDh3lW7+p TgynhfsIAOE4A04Cl+1WunXCWtFBv6kiEOMey1c6Ur4kn3/koUAZSaw8UOdTCf6/7jpT EjgA== X-Gm-Message-State: AOJu0YxNeqbw4ShWwsp+KyqJSSFB1uFuZX3/KPQ+Ekwd6hO3ZO4ZxtDW F7HlkeWuGhLGuDPlfnRVkRWwAd1iti35kJOwGnRlIg== X-Received: by 2002:a5d:51c2:0:b0:333:2fd2:51f0 with SMTP id n2-20020a5d51c2000000b003332fd251f0mr4397193wrv.105.1701810871355; Tue, 05 Dec 2023 13:14:31 -0800 (PST) MIME-Version: 1.0 References: <20231205-libstringheader-v1-1-7f9c573053a7@gmail.com> <20231205130449.8e330a26ecbed1f7b5ad5d7a@linux-foundation.org> In-Reply-To: <20231205130449.8e330a26ecbed1f7b5ad5d7a@linux-foundation.org> From: Nick Desaulniers Date: Tue, 5 Dec 2023 13:14:16 -0800 Message-ID: Subject: Re: [PATCH] lib/string: shrink lib/string.i via IWYU To: Andrew Morton Cc: tanzirh@google.com, Kees Cook , Andy Shevchenko , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Nick DeSaulniers , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 05 Dec 2023 13:14:50 -0800 (PST) On Tue, Dec 5, 2023 at 1:04=E2=80=AFPM Andrew Morton wrote: > > On Tue, 05 Dec 2023 20:58:53 +0000 tanzirh@google.com wrote: > > > This diff uses an open source tool include-what-you-use (IWYU) to modif= y > > the include list changing indirect includes to direct includes. > > IWYU is implemented using the IWYUScripts github repository which is a = tool that is > > currently undergoing development. These changes seek to improve build t= imes. > > > > This change to lib/string.c resulted in a preprocessed size of > > lib/string.i from 26371 lines to 5232 lines (-80%). > > > > If there are any problems with the output of the tool please raise an > > issue on the github. > > > > Link: https://github.com/ClangBuiltLinux/IWYUScripts > > Issue: > > > --- a/lib/string.c > > +++ b/lib/string.c > > @@ -16,16 +16,16 @@ > > > > #define __NO_FORTIFY > > #include > > +#include Thanks for the quick feedback. For additional context, Tanzir is my intern working on getting IWYU working on the kernel. Welcome Tanzir to LKML! > > The preferred way to import bit-fiddling stuff is to include > . Under the hood this may include asm/bitsperlong.h. Or > it may not, depending on Kconfig settings (particularly architecture). > Just triple checking my understanding; it looks like include/linux/bits.h unconditionally includes asm/bitsperlong.h (which is implemented per arch) most of which seem to include asm-generic/bitsperlong.h. include/linux/bits.h also defines a few macros (BIT_MASK, BIT_WORD, BITS_PER_BYTE, GENMASK, etc). If lib/string.c is not using any of those, why can't we go straight to #including asm/bitsperlong.h? That should resolve to the arch specific impl which may include asm-generic/bitsperlong.h? --=20 Thanks, ~Nick Desaulniers