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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 AE6C4C46477 for ; Tue, 11 Jun 2019 21:00:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77F1B2086A for ; Tue, 11 Jun 2019 21:00:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=dilger-ca.20150623.gappssmtp.com header.i=@dilger-ca.20150623.gappssmtp.com header.b="1PkfIHxo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407276AbfFKVAR (ORCPT ); Tue, 11 Jun 2019 17:00:17 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39399 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406815AbfFKVAQ (ORCPT ); Tue, 11 Jun 2019 17:00:16 -0400 Received: by mail-pf1-f194.google.com with SMTP id j2so8189613pfe.6 for ; Tue, 11 Jun 2019 14:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nUPaXZb2EyHCiKOm64w17o/WMgOXwq3cvo71tUNaOwE=; b=1PkfIHxoAL100GHTIJPtUgnC6vtovLyncp9xFBxlnggPu12+zsDGgnLaBjug3WcCRF ADQVr3JetSynDAQbtUt6ErvLUOeaCpig1636+Ma6Jq/Pzq9Wm8vruTUnsCFntkIJGXPX wWnf8ZOx9s4y5y8Qm3ZvQvL2os1TOwaLQLvbm9ZJou9U0nJzedf/8LPDMnNkHoMmIRvm 0JVJjUBp99ct05cqa2egnpZd13j2INZwnsHocqWKQQe5RqyURZIMrPteLnuZG4T+3ubQ FsvDJpuZH3QIeO3XlnkM7vdfDShdyMdLnG6hcUpiZJVNutSS2SeLa5Fxo2XceNqs4ysr 0rpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nUPaXZb2EyHCiKOm64w17o/WMgOXwq3cvo71tUNaOwE=; b=sT4EyzIDgRh2eVEn6XsLh6lcaLtxaiQLTgXQwd1B4nV5Cg83wY++VKAsccEsm7ahqe KIv5P+uia0E8nJsE0h18FclWLMTOFQr5KUNgE2YWKJTNX090Rje4Fdd9rXHmlCEjuTne kcqg2XwgTvybfikWI8Y/AzFvKxjJ00Y9cWpLt5jVQ0pPJWblYx6oZzDN8ZylHX1sC2CV GuDRyNwa90Pl+3+udwQxBbMLmlJ44KbWlI6iNkkxRDJ5Rj3oHEIg+6lGFvLI3OFT/9yb h9ZV32IPQMY9+3OwqjH5AnZ/c3doEEuu/5L4AXe9Pq0Ln1ljqjptaWkMK8NVYEbRNHKc oa6A== X-Gm-Message-State: APjAAAUVMqKPChHHMzGDxbRnRnggJ7ZZraz/hKIAbL1qST9+sdst/unK XpPTkBeyWHk4Ky8D2lvZKKTeTA== X-Google-Smtp-Source: APXvYqw4YBmB5zv3pmuSF2o1Ro24lhPZ3aL8+7Yz5YYkMM5A75U9mLeByV4nZS/X2MAaqVMFGY5qAQ== X-Received: by 2002:a63:4419:: with SMTP id r25mr22692286pga.247.1560286815720; Tue, 11 Jun 2019 14:00:15 -0700 (PDT) Received: from cabot.adilger.ext (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id l1sm14357897pgj.67.2019.06.11.14.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 14:00:14 -0700 (PDT) From: Andreas Dilger Message-Id: <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Date: Tue, 11 Jun 2019 15:00:10 -0600 In-Reply-To: <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> Cc: Shyam Saini , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org, linux-ext4 , devel@lists.orangefs.org, linux-mm@kvack.org, linux-sctp@vger.kernel.org, bpf@vger.kernel.org, kvm@vger.kernel.org, mayhs11saini@gmail.com, Alexey Dobriyan To: Andrew Morton References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jun 11, 2019, at 2:48 PM, Andrew Morton = wrote: >=20 > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini = wrote: >=20 >> Currently, there are 3 different macros, namely sizeof_field, = SIZEOF_FIELD >> and FIELD_SIZEOF which are used to calculate the size of a member of >> structure, so to bring uniformity in entire kernel source tree lets = use >> FIELD_SIZEOF and replace all occurrences of other two macros with = this. >>=20 >> For this purpose, redefine FIELD_SIZEOF in include/linux/stddef.h and >> tools/testing/selftests/bpf/bpf_util.h and remove its defination from >> include/linux/kernel.h >>=20 >> In favour of FIELD_SIZEOF, this patch also deprecates other two = similar >> macros sizeof_field and SIZEOF_FIELD. >>=20 >> For code compatibility reason, retain sizeof_field macro as a wrapper = macro >> to FIELD_SIZEOF >=20 > As Alexey has pointed out, C structs and unions don't have fields - > they have members. So this is an opportunity to switch everything to > a new member_sizeof(). >=20 > What do people think of that and how does this impact the patch = footprint? I did a check, and FIELD_SIZEOF() is used about 350x, while = sizeof_field() is about 30x, and SIZEOF_FIELD() is only about 5x. That said, I'm much more in favour of "sizeof_field()" or = "sizeof_member()" than FIELD_SIZEOF(). Not only does that better match "offsetof()", with which it is closely related, but is also closer to the original = "sizeof()". Since this is a rather trivial change, it can be split into a number of patches to get approval/landing via subsystem maintainers, and there is = no huge urgency to remove the original macros until the users are gone. It would make sense to remove SIZEOF_FIELD() and sizeof_field() quickly so they don't gain more users, and the remaining FIELD_SIZEOF() users can = be whittled away as the patches come through the maintainer trees. Cheers, Andreas --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl0AFloACgkQcqXauRfM H+AuLxAAgNkosRb8jCBUvSkSZcRIz6m3CRCKyZBz9EPhtA2ihZfEB+0hz1uGmXS5 opkX/nM8cIIrc2g/uiWBq6RVg8FFJxC3qVRDhPqDJ5b6jq6Q5WjV98HwBljIKIEM EWXmiEtnxAQAWrNcYoI0HAI5nMUxpIHxo0+hWnfLhk/fTPoUwgLgZawDmn+pwcND DU07/6GM67fcfUGYxZKD43X6a/s2lkR28Nn3MN7o2Y/exOm6J0otNWB4Vsu7d6t/ cScoBhni7d5c02FbLXTpab1n/Sjq/+Ijd3yp3ooxjoFvhfqx6YoBYL5fKxZx29HO AXautmzcIwSccj17hB9lIvq/lLdXBL/k9qiKBcIzImCLxSa9+hMJFcl4gH3Qo4i7 J+7jzFHXnFnx9g5J4rka5VIlGpbBM85N35g8vJZFGVc/juJm6r6YXA+48kKI6hZB uFH8fNhjYJGDFyiCh637pF5CObUattAasEPN8O8mQ3qxZKg8C/9jvOLgHlI9W9iK ijBEDk0atDHpIJe3dlUw/fQA7LZ4bvXe07VUBqnBUd+/+7KBLZxLkfnygJXf8nzX k0TILorUWagkDNgpBE/vwV1ER8UzU6NRxz/w4e6/N/mufG7iPcxZjCTtfJUS3GLW hPKj3bi6qV6cw+EyroLHp9igONkqhvnPjEFx5a4YA3gAxQ8viSE= =5D1y -----END PGP SIGNATURE----- --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Date: Tue, 11 Jun 2019 21:00:10 +0000 Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Message-Id: <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7" List-Id: References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> In-Reply-To: <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> To: Andrew Morton Cc: Shyam Saini , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org, linux-ext4 , devel@lists.orangefs.org, linux-mm@kvack.org, linux-sctp@vger.kernel.org, bpf@vger.kernel.org, kvm@vger.kernel.org, mayhs11saini@gmail.com, Alexey Dobriyan --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jun 11, 2019, at 2:48 PM, Andrew Morton = wrote: >=20 > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini = wrote: >=20 >> Currently, there are 3 different macros, namely sizeof_field, = SIZEOF_FIELD >> and FIELD_SIZEOF which are used to calculate the size of a member of >> structure, so to bring uniformity in entire kernel source tree lets = use >> FIELD_SIZEOF and replace all occurrences of other two macros with = this. >>=20 >> For this purpose, redefine FIELD_SIZEOF in include/linux/stddef.h and >> tools/testing/selftests/bpf/bpf_util.h and remove its defination from >> include/linux/kernel.h >>=20 >> In favour of FIELD_SIZEOF, this patch also deprecates other two = similar >> macros sizeof_field and SIZEOF_FIELD. >>=20 >> For code compatibility reason, retain sizeof_field macro as a wrapper = macro >> to FIELD_SIZEOF >=20 > As Alexey has pointed out, C structs and unions don't have fields - > they have members. So this is an opportunity to switch everything to > a new member_sizeof(). >=20 > What do people think of that and how does this impact the patch = footprint? I did a check, and FIELD_SIZEOF() is used about 350x, while = sizeof_field() is about 30x, and SIZEOF_FIELD() is only about 5x. That said, I'm much more in favour of "sizeof_field()" or = "sizeof_member()" than FIELD_SIZEOF(). Not only does that better match "offsetof()", with which it is closely related, but is also closer to the original = "sizeof()". Since this is a rather trivial change, it can be split into a number of patches to get approval/landing via subsystem maintainers, and there is = no huge urgency to remove the original macros until the users are gone. It would make sense to remove SIZEOF_FIELD() and sizeof_field() quickly so they don't gain more users, and the remaining FIELD_SIZEOF() users can = be whittled away as the patches come through the maintainer trees. Cheers, Andreas --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl0AFloACgkQcqXauRfM H+AuLxAAgNkosRb8jCBUvSkSZcRIz6m3CRCKyZBz9EPhtA2ihZfEB+0hz1uGmXS5 opkX/nM8cIIrc2g/uiWBq6RVg8FFJxC3qVRDhPqDJ5b6jq6Q5WjV98HwBljIKIEM EWXmiEtnxAQAWrNcYoI0HAI5nMUxpIHxo0+hWnfLhk/fTPoUwgLgZawDmn+pwcND DU07/6GM67fcfUGYxZKD43X6a/s2lkR28Nn3MN7o2Y/exOm6J0otNWB4Vsu7d6t/ cScoBhni7d5c02FbLXTpab1n/Sjq/+Ijd3yp3ooxjoFvhfqx6YoBYL5fKxZx29HO AXautmzcIwSccj17hB9lIvq/lLdXBL/k9qiKBcIzImCLxSa9+hMJFcl4gH3Qo4i7 J+7jzFHXnFnx9g5J4rka5VIlGpbBM85N35g8vJZFGVc/juJm6r6YXA+48kKI6hZB uFH8fNhjYJGDFyiCh637pF5CObUattAasEPN8O8mQ3qxZKg8C/9jvOLgHlI9W9iK ijBEDk0atDHpIJe3dlUw/fQA7LZ4bvXe07VUBqnBUd+/+7KBLZxLkfnygJXf8nzX k0TILorUWagkDNgpBE/vwV1ER8UzU6NRxz/w4e6/N/mufG7iPcxZjCTtfJUS3GLW hPKj3bi6qV6cw+EyroLHp9igONkqhvnPjEFx5a4YA3gAxQ8viSE= =5D1y -----END PGP SIGNATURE----- --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7-- 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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH autolearn=ham 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 9E88FC31E44 for ; Tue, 11 Jun 2019 21:00:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71892206BA for ; Tue, 11 Jun 2019 21:00:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FkjXCwz4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=dilger-ca.20150623.gappssmtp.com header.i=@dilger-ca.20150623.gappssmtp.com header.b="1PkfIHxo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71892206BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dilger.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:To:In-Reply-To:Date:Subject:Mime-Version:Message-Id:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+/6rddXkaiJs86W3yOE147HiK8I2+kYBgBiJdYuVfzU=; b=FkjXCwz4X7SHRIFvC4/v6pTtS cS66gH7v/NjwnbM1JWzBpo82jGolyxBchxRcL0hq5zP5I4R/140Z/c6elWoUU44Z0EJpW9UpX0DRW xLRKoqq7xyylPyeFgdF6dnXx0XMuSI2AJma5TqCCt83JyJO5Qs1EBX/e4MNe3BVeCpiuQC/j6RgJP hp+Z3B8D9sBDAaqVV8gxmYZYWo92iXs+ta1h65fkqa6mVaAi/6VzVK4gnQjMqp3ANlzaagBHPvw3x KZfBGYjt/o/hG26MIzO6IzJQPTdGGUhktRe3gJlT9zGLGPJIFQjJf9YwYtvR64fcAfDKQYc0KGOtZ PZ+8wAr4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hansX-0002KC-ET; Tue, 11 Jun 2019 21:00:25 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hansQ-0002Ic-W2 for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2019 21:00:23 +0000 Received: by mail-pg1-x543.google.com with SMTP id n2so7616489pgp.11 for ; Tue, 11 Jun 2019 14:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nUPaXZb2EyHCiKOm64w17o/WMgOXwq3cvo71tUNaOwE=; b=1PkfIHxoAL100GHTIJPtUgnC6vtovLyncp9xFBxlnggPu12+zsDGgnLaBjug3WcCRF ADQVr3JetSynDAQbtUt6ErvLUOeaCpig1636+Ma6Jq/Pzq9Wm8vruTUnsCFntkIJGXPX wWnf8ZOx9s4y5y8Qm3ZvQvL2os1TOwaLQLvbm9ZJou9U0nJzedf/8LPDMnNkHoMmIRvm 0JVJjUBp99ct05cqa2egnpZd13j2INZwnsHocqWKQQe5RqyURZIMrPteLnuZG4T+3ubQ FsvDJpuZH3QIeO3XlnkM7vdfDShdyMdLnG6hcUpiZJVNutSS2SeLa5Fxo2XceNqs4ysr 0rpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nUPaXZb2EyHCiKOm64w17o/WMgOXwq3cvo71tUNaOwE=; b=M/F1gZmaIMwn2U4LywKRt4J3Q5E45pw56nZt1cOguuPirzFODjzHK+usBAF2G4ahym NOTtzRhbS3g45O9ovz5i5YpUcYU4nQthsK3dIZ22kJABJyHNPvkU/3aFXiaApda8clRD gFOldmmTzMRg84jM8QF5L364MVFlmJLCg3vOWRd6omqiAKIWtMvSf57JZCBJ0uQQwfQG uof9laeKmnxiEO6XX+NVwzU5kWCo1rc6hYoDmVT5T3Z3auc18bwhHnAUNKWLXPqxwOyn yUNGaX8Etd+xIXJxC6YFX6mChPUZv3p2q/3nkLlf+G8qiZpEFkU6W0UnvhPmcYAvQ0Yn NXUw== X-Gm-Message-State: APjAAAVmVHMVD/bY5mEErXq3MbUGRFS0LlZr8i/nefqW7ew8HR9FeKjZ HJi+06dl3uid9U7TMMJwpak5tA== X-Google-Smtp-Source: APXvYqw4YBmB5zv3pmuSF2o1Ro24lhPZ3aL8+7Yz5YYkMM5A75U9mLeByV4nZS/X2MAaqVMFGY5qAQ== X-Received: by 2002:a63:4419:: with SMTP id r25mr22692286pga.247.1560286815720; Tue, 11 Jun 2019 14:00:15 -0700 (PDT) Received: from cabot.adilger.ext (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id l1sm14357897pgj.67.2019.06.11.14.00.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 14:00:14 -0700 (PDT) From: Andreas Dilger Message-Id: <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Date: Tue, 11 Jun 2019 15:00:10 -0600 In-Reply-To: <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> To: Andrew Morton References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> X-Mailer: Apple Mail (2.3273) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190611_140019_702399_A57C8443 X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: keescook@chromium.org, kvm@vger.kernel.org, kernel-hardening@lists.openwall.com, netdev@vger.kernel.org, intel-gfx@lists.freedesktop.org, devel@lists.orangefs.org, linux-mips@vger.kernel.org, Shyam Saini , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-sctp@vger.kernel.org, dri-devel@lists.freedesktop.org, bpf@vger.kernel.org, linux-ext4 , intel-gvt-dev@lists.freedesktop.org, Alexey Dobriyan , linux-arm-kernel@lists.infradead.org, mayhs11saini@gmail.com Content-Type: multipart/mixed; boundary="===============4171055446297400033==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4171055446297400033== Content-Type: multipart/signed; boundary="Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7"; protocol="application/pgp-signature"; micalg=pgp-sha256 --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jun 11, 2019, at 2:48 PM, Andrew Morton = wrote: >=20 > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini = wrote: >=20 >> Currently, there are 3 different macros, namely sizeof_field, = SIZEOF_FIELD >> and FIELD_SIZEOF which are used to calculate the size of a member of >> structure, so to bring uniformity in entire kernel source tree lets = use >> FIELD_SIZEOF and replace all occurrences of other two macros with = this. >>=20 >> For this purpose, redefine FIELD_SIZEOF in include/linux/stddef.h and >> tools/testing/selftests/bpf/bpf_util.h and remove its defination from >> include/linux/kernel.h >>=20 >> In favour of FIELD_SIZEOF, this patch also deprecates other two = similar >> macros sizeof_field and SIZEOF_FIELD. >>=20 >> For code compatibility reason, retain sizeof_field macro as a wrapper = macro >> to FIELD_SIZEOF >=20 > As Alexey has pointed out, C structs and unions don't have fields - > they have members. So this is an opportunity to switch everything to > a new member_sizeof(). >=20 > What do people think of that and how does this impact the patch = footprint? I did a check, and FIELD_SIZEOF() is used about 350x, while = sizeof_field() is about 30x, and SIZEOF_FIELD() is only about 5x. That said, I'm much more in favour of "sizeof_field()" or = "sizeof_member()" than FIELD_SIZEOF(). Not only does that better match "offsetof()", with which it is closely related, but is also closer to the original = "sizeof()". Since this is a rather trivial change, it can be split into a number of patches to get approval/landing via subsystem maintainers, and there is = no huge urgency to remove the original macros until the users are gone. It would make sense to remove SIZEOF_FIELD() and sizeof_field() quickly so they don't gain more users, and the remaining FIELD_SIZEOF() users can = be whittled away as the patches come through the maintainer trees. Cheers, Andreas --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl0AFloACgkQcqXauRfM H+AuLxAAgNkosRb8jCBUvSkSZcRIz6m3CRCKyZBz9EPhtA2ihZfEB+0hz1uGmXS5 opkX/nM8cIIrc2g/uiWBq6RVg8FFJxC3qVRDhPqDJ5b6jq6Q5WjV98HwBljIKIEM EWXmiEtnxAQAWrNcYoI0HAI5nMUxpIHxo0+hWnfLhk/fTPoUwgLgZawDmn+pwcND DU07/6GM67fcfUGYxZKD43X6a/s2lkR28Nn3MN7o2Y/exOm6J0otNWB4Vsu7d6t/ cScoBhni7d5c02FbLXTpab1n/Sjq/+Ijd3yp3ooxjoFvhfqx6YoBYL5fKxZx29HO AXautmzcIwSccj17hB9lIvq/lLdXBL/k9qiKBcIzImCLxSa9+hMJFcl4gH3Qo4i7 J+7jzFHXnFnx9g5J4rka5VIlGpbBM85N35g8vJZFGVc/juJm6r6YXA+48kKI6hZB uFH8fNhjYJGDFyiCh637pF5CObUattAasEPN8O8mQ3qxZKg8C/9jvOLgHlI9W9iK ijBEDk0atDHpIJe3dlUw/fQA7LZ4bvXe07VUBqnBUd+/+7KBLZxLkfnygJXf8nzX k0TILorUWagkDNgpBE/vwV1ER8UzU6NRxz/w4e6/N/mufG7iPcxZjCTtfJUS3GLW hPKj3bi6qV6cw+EyroLHp9igONkqhvnPjEFx5a4YA3gAxQ8viSE= =5D1y -----END PGP SIGNATURE----- --Apple-Mail=_31ECB8A0-2497-4644-8BE0-DFE1190172F7-- --===============4171055446297400033== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4171055446297400033==--