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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 03223C31E44 for ; Tue, 11 Jun 2019 21:28:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C26262086A for ; Tue, 11 Jun 2019 21:28:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uikxw7Ut" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436553AbfFKV2N (ORCPT ); Tue, 11 Jun 2019 17:28:13 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:36867 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407653AbfFKV2L (ORCPT ); Tue, 11 Jun 2019 17:28:11 -0400 Received: by mail-ot1-f66.google.com with SMTP id r10so13386785otd.4; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=uikxw7UtyOptEVyjeY2qK4xy247KZZSlixb4FYF44cy5IOYuGfhYNz0auK7eAN3lSf RDykMi53c/UWnKOss3Gbf99f02SgcsLInyU9jZT7mZ9OHg9hKC6fNrTncVfEUwMvFzyT LcQoyh1B+GWH1wcVdCBdLQqRjW9xbNzL/XHVXJwKNd+h41OfOLBnxXrK/w2EGMY7Sdql Ev+iISe8afAaHYadIsKtGIEgMDX6CnpwHgbsBe+aUSzQIjTpiqosNwjLo3ub7MMP5bSh sv6W0b+fg0PHcDLs3IdJMwn13c7joqsHqAOaS3kYpN0/uUkfhOoBhUB3X+c5vOw3dtMp LbTg== 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=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=VWmUwoR9ygSpzmu4vbM58zXol8+svInEvDKpx3nMhm+HUUPkpjQFP1iBHSaJGr19vS 95FjdqeDmEyVPNLlHxujyrkm+XB4c3pgqKNuXE+cLYd/6DCBbHTUOBSY1Laaci39LtAm ku1YQurhfqt7Rsv8jIxnJmTy8eNUu16xvKh+JlNnQ+qNcCuvvECDFZqTp7Wf5ar24t1A BRP7ry1XKTd2FrHGlum+xDxKYmUGvI7VeTQgDFmlyPKlnt8yATbnMkJ4keOnzeO78NJ+ GoEKrkqND1eAAqYaVDicBO/APMs+b88oGYLOtNTBHO11uwPHSqsANgEcL7+k6MWX8RTw fF7w== X-Gm-Message-State: APjAAAVBb8lSaSZmNEGcGH0pWaR+0rEHRIElG+mC9Z4PHENl0VkTWb6j Ga0+tOEQHcrmhOUsjZQTRQ0HuPqxUKfRt+DCN84= X-Google-Smtp-Source: APXvYqwZE6DuGW97Wtdkbau380s5wncliqmuWNA2I8e3nRFVHn0Gyt7oiNVh7GBK4ctz/0QIVrifVcW0qHRMDnaPYKk= X-Received: by 2002:a9d:7b43:: with SMTP id f3mr18847440oto.337.1560288490020; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) MIME-Version: 1.0 References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> In-Reply-To: <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> From: Shyam Saini Date: Wed, 12 Jun 2019 02:57:58 +0530 Message-ID: Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro To: Andrew Morton Cc: Andreas Dilger , Shyam Saini , Kernel Hardening , linux-kernel , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel , Network Development , linux-ext4 , devel@lists.orangefs.org, linux-mm , linux-sctp@vger.kernel.org, bpf , kvm@vger.kernel.org, Alexey Dobriyan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > > > >> to FIELD_SIZEOF > > > > > > 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(). > > > > > > 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. > > Erk. Sorry, I should have grepped. > > > 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. > > In that case I'd say let's live with FIELD_SIZEOF() and remove > sizeof_field() and SIZEOF_FIELD(). > > I'm a bit surprised that the FIELD_SIZEOF() definition ends up in > stddef.h rather than in kernel.h where such things are normally > defined. Why is that? Thanks for pointing out this, I was not aware if this is a convention. Anyway, I'll keep FIELD_SIZEOF definition in kernel.h in next version. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shyam Saini Date: Tue, 11 Jun 2019 21:39:58 +0000 Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Message-Id: List-Id: References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> In-Reply-To: <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andrew Morton Cc: Andreas Dilger , Shyam Saini , Kernel Hardening , linux-kernel , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel , Network Development , linux-ext4 , devel@lists.orangefs.org, linux-mm , linux-sctp@vger.kernel.org, bpf , kvm@vger.kernel.org, Alexey Dobriyan Hi Andrew, > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > > > >> to FIELD_SIZEOF > > > > > > 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(). > > > > > > 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. > > Erk. Sorry, I should have grepped. > > > 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. > > In that case I'd say let's live with FIELD_SIZEOF() and remove > sizeof_field() and SIZEOF_FIELD(). > > I'm a bit surprised that the FIELD_SIZEOF() definition ends up in > stddef.h rather than in kernel.h where such things are normally > defined. Why is that? Thanks for pointing out this, I was not aware if this is a convention. Anyway, I'll keep FIELD_SIZEOF definition in kernel.h in next version. 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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 2A6D2C31E46 for ; Tue, 11 Jun 2019 21:28:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D4A442086A for ; Tue, 11 Jun 2019 21:28:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uikxw7Ut" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4A442086A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 858D86B0008; Tue, 11 Jun 2019 17:28:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E1A76B000A; Tue, 11 Jun 2019 17:28:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A9016B000C; Tue, 11 Jun 2019 17:28:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by kanga.kvack.org (Postfix) with ESMTP id 429696B0008 for ; Tue, 11 Jun 2019 17:28:11 -0400 (EDT) Received: by mail-oi1-f198.google.com with SMTP id f19so4624717oib.4 for ; Tue, 11 Jun 2019 14:28:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:references :in-reply-to:from:date:message-id:subject:to:cc; bh=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=Gu31PHy+jYUBQwk74GLjZa99d7vCQ2BoXUFo0YdD94SYwKvuh/PUt6eybuQ7ykgXdZ MyoQeydmYFCc3HDH2p0pjxiIDSpo6rBf0QqmSY4t1CllTJdH4BATOL4jiD9n/mn1TzQk r4MUyAd/ISL/nOtf9duijiaaJNmIePCv3ydpcc2Dp2lbN1MsInWAMG1KwI0oKPBqpP2Y 4synyt128UWP6zIQod5G9/DFsayAKRN7sSu2V5FWvfefsR8Yjn60ZE2zt9vs+7x3hZFt v1MsWUUsU6DlzPfffExeVEaj6uWTsNZpA+NuBE7d9vjkQH0lQRRasWUSohGLPeTAL0D8 819g== X-Gm-Message-State: APjAAAVYd9KkcFEn3L94li5R7IHjYvIuhpyR84sXQ9O+dar6dwh14aeE yZdJu8YIp3TYJseSZpv4YaQt65S+dJgo0XXAxhTIUs3lmSKqBTIpVEde8ta6plOHChTg/n2xMhn C8HxyxZuR6sJk2BfB1n3dmfAKsaZ1YPweMwuBL1yrvtpn0LsM7BElZZbxsDqrouxWSg== X-Received: by 2002:aca:3256:: with SMTP id y83mr17737740oiy.110.1560288490921; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) X-Received: by 2002:aca:3256:: with SMTP id y83mr17737709oiy.110.1560288490386; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560288490; cv=none; d=google.com; s=arc-20160816; b=ht+VglvM+duH4trvyHxJoAji/RYjzI766cjsqDa/ITIPC0DeBdqxJJi1QP4cuYi8rs kiDbfCLu7YLTWMHe87AQu3yZ7g2HHcLentkFYlwgI7zTI9idlaCnuVmJRRgYU1/YFmlw Xo2tnho54YRyO0eZHKpNrb7PmYYZ0iHWGSXVULyfOb1BqEbIkRIdqQcUH47HsYR6Js+y xMwBqsc9xgGFuLFt1mhUEOuj5r6A/YYrUJwjnfykejzMGfGxVOaK4HuZXsdel1YglCoZ rpM2UMWq8CXRajXz0KT0jQfqbMARkQArykqVnWEgnB7e+7V6cXdRnG5nvCLY6liHAUrk t7nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=cwwILbAkS8nQHwkVJhsDyxkeuR8ZhaiBNHjgWbZG5AWb7PvdpJvbaPgNajDQm0lhnJ 1GUMkUVqNRvBOfCwnnUcUq58qVYlljzmF0JYXDYIAolNqN92Jp3FqsvuHAaXwWNWVrGZ MPYsSz6E5TrcDjkp3dqpy0j3+Jb2PaIvFE28FGrcKNqkvmXzuHTBLM2Wkxv1Uy7Ch1rp K9wF29l1Ge1bwprz6yKbHi/LGQ1RmRgkPwyZIfSi6gi97DS/As+Zdr8h3PkLw8VQUcX7 w7ACEFKYI8DyxgxnyILHpdiT5prpMobllP20AaKtMCCz0OXsC+kFLfoo2mG/EXr2VorA XJ8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uikxw7Ut; spf=pass (google.com: domain of mayhs11saini@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mayhs11saini@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 70sor2838989otl.86.2019.06.11.14.28.10 for (Google Transport Security); Tue, 11 Jun 2019 14:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of mayhs11saini@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uikxw7Ut; spf=pass (google.com: domain of mayhs11saini@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mayhs11saini@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=uikxw7UtyOptEVyjeY2qK4xy247KZZSlixb4FYF44cy5IOYuGfhYNz0auK7eAN3lSf RDykMi53c/UWnKOss3Gbf99f02SgcsLInyU9jZT7mZ9OHg9hKC6fNrTncVfEUwMvFzyT LcQoyh1B+GWH1wcVdCBdLQqRjW9xbNzL/XHVXJwKNd+h41OfOLBnxXrK/w2EGMY7Sdql Ev+iISe8afAaHYadIsKtGIEgMDX6CnpwHgbsBe+aUSzQIjTpiqosNwjLo3ub7MMP5bSh sv6W0b+fg0PHcDLs3IdJMwn13c7joqsHqAOaS3kYpN0/uUkfhOoBhUB3X+c5vOw3dtMp LbTg== X-Google-Smtp-Source: APXvYqwZE6DuGW97Wtdkbau380s5wncliqmuWNA2I8e3nRFVHn0Gyt7oiNVh7GBK4ctz/0QIVrifVcW0qHRMDnaPYKk= X-Received: by 2002:a9d:7b43:: with SMTP id f3mr18847440oto.337.1560288490020; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) MIME-Version: 1.0 References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> In-Reply-To: <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> From: Shyam Saini Date: Wed, 12 Jun 2019 02:57:58 +0530 Message-ID: Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro To: Andrew Morton Cc: Andreas Dilger , Shyam Saini , Kernel Hardening , linux-kernel , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel , Network Development , linux-ext4 , devel@lists.orangefs.org, linux-mm , linux-sctp@vger.kernel.org, bpf , kvm@vger.kernel.org, Alexey Dobriyan Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Andrew, > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > > > >> to FIELD_SIZEOF > > > > > > 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(). > > > > > > 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. > > Erk. Sorry, I should have grepped. > > > 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. > > In that case I'd say let's live with FIELD_SIZEOF() and remove > sizeof_field() and SIZEOF_FIELD(). > > I'm a bit surprised that the FIELD_SIZEOF() definition ends up in > stddef.h rather than in kernel.h where such things are normally > defined. Why is that? Thanks for pointing out this, I was not aware if this is a convention. Anyway, I'll keep FIELD_SIZEOF definition in kernel.h in next version. 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.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 B71DAC31E44 for ; Tue, 11 Jun 2019 21:28:25 +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 6AB662086A for ; Tue, 11 Jun 2019 21:28:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="k8UO7+KA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uikxw7Ut" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AB662086A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PrtwzaYUtb3t96OQFNi9FndEETjTFS1tkIyn1JBSiaA=; b=k8UO7+KAQSj3ql jJLxInQrRP1ClMPnQNUMZuPwGjTwaq3QAHfrSOmzF0H2ifPgNLTELVwzDG4FkoUzWLxRaB4o6Doj7 X4a86PfQ/SWWI+RAYAst054yyAAF/9rBReTgrMm/B3UOea+o1d+Uye2wweKotVmTDanoUQhSx8apo QhEF+Vfc0qQSzibwEzNaCcK36VYWud9HoZ1aBe0FeLYPUrW4YUAl+ViUNz5KBdW+R0oLQL2Riz1kX tdImSXc6ZcJEOfpp+3Vk4RcUWRw+SqArd3Z9PpQfwwoQbrW0Ml2QbthC0WnipOtrdhKH0LfVcFIoG e5CtMs/2KPBjqgiEY1lQ==; 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 1haoJS-0006Fa-M7; Tue, 11 Jun 2019 21:28:14 +0000 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1haoJO-0006BN-R4 for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2019 21:28:12 +0000 Received: by mail-ot1-x343.google.com with SMTP id d17so13379208oth.5 for ; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=uikxw7UtyOptEVyjeY2qK4xy247KZZSlixb4FYF44cy5IOYuGfhYNz0auK7eAN3lSf RDykMi53c/UWnKOss3Gbf99f02SgcsLInyU9jZT7mZ9OHg9hKC6fNrTncVfEUwMvFzyT LcQoyh1B+GWH1wcVdCBdLQqRjW9xbNzL/XHVXJwKNd+h41OfOLBnxXrK/w2EGMY7Sdql Ev+iISe8afAaHYadIsKtGIEgMDX6CnpwHgbsBe+aUSzQIjTpiqosNwjLo3ub7MMP5bSh sv6W0b+fg0PHcDLs3IdJMwn13c7joqsHqAOaS3kYpN0/uUkfhOoBhUB3X+c5vOw3dtMp LbTg== 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=yfYsg0/cES0OHcG6fX5W9snm90ggOgAM9kXY3QBEhu4=; b=LBgr14Iubj7svYsPS5erd7IewIgIYnT2mPpFLt22Q3vBUY0JFMEiwHjR5NPdy9jyEM gSKelziE+rHmP9nQVLU/sfnTPEmkLEjniybOGY0/6odK/z5nLxjagwC1WU2l65RBwlH/ dPKwExNp/F2pjDfinxLcIih7kodP3ZCs+GSfHGYrJJgh8CHI+ur+3KRlBKEYAVey8b0T 4Vih6so8isVyPmpzmBox1tqYhMKnwSBOBsjaa8+2koqpUvc57RuydjkFnTWAGJrWu5Z1 SvP956cAsxDjlXyum+3LjSy4qS0nrXcpBpH0q+ogRLaYkMyIEDh3eHgv153/4hO5SMTN WKvQ== X-Gm-Message-State: APjAAAX5MhmnVctPeNQFVJELq9W1uFY+qbNnnvEey5MxdmpuZ+7AX3Fm lonqIhY91imAPQDPC+VZ4oGK8SFn8cbwRrydtBo= X-Google-Smtp-Source: APXvYqwZE6DuGW97Wtdkbau380s5wncliqmuWNA2I8e3nRFVHn0Gyt7oiNVh7GBK4ctz/0QIVrifVcW0qHRMDnaPYKk= X-Received: by 2002:a9d:7b43:: with SMTP id f3mr18847440oto.337.1560288490020; Tue, 11 Jun 2019 14:28:10 -0700 (PDT) MIME-Version: 1.0 References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> In-Reply-To: <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> From: Shyam Saini Date: Wed, 12 Jun 2019 02:57:58 +0530 Message-ID: Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190611_142810_914972_6D7D6087 X-CRM114-Status: GOOD ( 19.04 ) 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: Andreas Dilger , Kees Cook , kvm@vger.kernel.org, Kernel Hardening , Network Development , intel-gfx@lists.freedesktop.org, devel@lists.orangefs.org, linux-kernel , Shyam Saini , linux-mips@vger.kernel.org, linux-mm , linux-sctp@vger.kernel.org, dri-devel , bpf , linux-ext4 , intel-gvt-dev@lists.freedesktop.org, Alexey Dobriyan , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Andrew, > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > > > >> to FIELD_SIZEOF > > > > > > 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(). > > > > > > 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. > > Erk. Sorry, I should have grepped. > > > 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. > > In that case I'd say let's live with FIELD_SIZEOF() and remove > sizeof_field() and SIZEOF_FIELD(). > > I'm a bit surprised that the FIELD_SIZEOF() definition ends up in > stddef.h rather than in kernel.h where such things are normally > defined. Why is that? Thanks for pointing out this, I was not aware if this is a convention. Anyway, I'll keep FIELD_SIZEOF definition in kernel.h in next version. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel