Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1879786iog; Tue, 14 Jun 2022 15:50:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1srSWyjwFpakwH+MsEAgrWL5xtbFhZ/scT1I1Y3wDzKKRsJ0c/7upvkkXcRRx94PvZX28T2 X-Received: by 2002:a17:903:245:b0:168:efbc:c10 with SMTP id j5-20020a170903024500b00168efbc0c10mr4144227plh.71.1655247056175; Tue, 14 Jun 2022 15:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655247056; cv=none; d=google.com; s=arc-20160816; b=S097mlSmin6X/vtMS3nKiudaYnuuo2iFe2a9qfjONkld3P4SsKVPE53VjxL/McFrTl v8DaKb0QIpkwR+PIjDkOoVGdNlAJVqdMRvrsMbk/wr1gXmLgtvE3c0mPmgG9FCzGpeEG o7gqgZmcTIdHYopPgVdtSFddULsAPVZ6wx6nnJOnwgsvwkkb78v1DOWyvnG+mZskT9GX SsiLJCUm+CE28z+cxVcjufwqK97K+/gk4u+aF3o4SVGHJLthN84UMkZL+jofG9xhOIqQ o0wrPqolNIBXLBWf5AF/jNmtZhTgrvtr458tmcAQlURKMDRhnUMmxq7WcFp7XznuOa2N wU8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HJr/fmSdEUSj6RNS8UsQWtv/38YJNaYwQGOi8xjnmhk=; b=SpJMzLGf+i0zQ3Y9UD/qYaGRNwwkVt2v3tA/sq6/LPAZhrT+g/Dd8OJfu5veUqVZlF OQZY63d0OoiWKql+obnUMASL+DA0FrSlUINZIcAz7GlB8QEm/aN8ewsXBz4uR8CqqRLR f9c4fpSwQD2xRbkTg3SwYBx5Sd4c5f90MeCjnvZ7VHPJIxcGCq9dmaa2CCoSBEQ4f/Zq J0uw1ecZYwOcaXj16DBW/0gjZOVbLY5nvdCrWXL3JKsesU5eRuTdidSlCMEVPuyaiJ6E 9YNQCRs0xByFNHUjqStm9WocA3LLzvgEVE64Xd2Yf8E5vnqdK/FzqMx0brgRSs25xU+K tSLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=csmfMYpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu7-20020a17090b1b0700b001dfd2940a5asi503251pjb.112.2022.06.14.15.50.41; Tue, 14 Jun 2022 15:50:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=csmfMYpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344724AbiFNW1i (ORCPT + 99 others); Tue, 14 Jun 2022 18:27:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235582AbiFNW1f (ORCPT ); Tue, 14 Jun 2022 18:27:35 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2B2815712; Tue, 14 Jun 2022 15:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HJr/fmSdEUSj6RNS8UsQWtv/38YJNaYwQGOi8xjnmhk=; b=csmfMYpeqiFH61nyMnTC1wjmny 4PoLkBeX5DASAjEJOMgudvSheddDCYi/tRmIXsLGe2pqXWBea9nc91IauraULMBMz58B2WzN+otQu YV6GGJit+9Td+Zf96TVE8ermReBzP/tn5wQvjP+hY4UQwhJSO+AUNzehkeoLredjE0U6+pWVnfKxt M8+j9dGLmObynPegX+ZbCRRPKuLWFn+ekkkwyRavaOicWmAkbX4797DzrSQx5QbdVab08LmnUfNFZ MCNim1faGLMm66QvBjvc9H3+X6al2k8bbD+3a65OlDsfjqsO2S93tDn8NkuZ7stvndGFhNAm4fjjD lvK+A2Zw==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1F0K-007xuf-1X; Tue, 14 Jun 2022 22:27:21 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 160E030008D; Wed, 15 Jun 2022 00:27:18 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 01CFC26642EEC; Wed, 15 Jun 2022 00:27:17 +0200 (CEST) Date: Wed, 15 Jun 2022 00:27:17 +0200 From: Peter Zijlstra To: Nick Desaulniers Cc: Linus Torvalds , Alexander Potapenko , Evgenii Stepanov , Kees Cook , Marco Elver , Nathan Chancellor , Thomas Gleixner , Vitaly Buka , Linux Kernel Mailing List , linux-toolchains Subject: Re: [PATCH] [RFC] Initialization of unused function parameters Message-ID: References: <20220614144853.3693273-1-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 14, 2022 at 11:08:33AM -0700, Nick Desaulniers wrote: > One thing I'm curious about; if you have an aggregate in C (struct or > array) and don't fully initialize the whole object, just > members/sub-objects, but only use those I assume that's not UB? (Which > is what my maybe_init example does). I think that's fine. Perf does something like that. We only explicitly initialize the first cacheline of a structure because that's *always* used. Any other field will only be initialized on request. At the time (and i've not benchmarked this in a good few years) that was a significant performance win.