Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5063247ybi; Tue, 11 Jun 2019 18:29:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+cpgaedgFnSvaPSHJv5u88YnnmGrVqZjvMRh0f9Gy9qPdvDvip2bwxlccLSRVAFUDBv7K X-Received: by 2002:a65:63c3:: with SMTP id n3mr2710602pgv.139.1560302980712; Tue, 11 Jun 2019 18:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560302980; cv=none; d=google.com; s=arc-20160816; b=V4UN6lVOMJpKeS1XhJcT9xgKKQN8YvjlI68/KCOcIl3IKWOB+kqm1YxZUXdy8oVoan EMGr76xUL/q/V6z1TRVBXi+uLWgwNIP9Ew1ywmEyvUfGbRktgam687Jh9xTWcgTgW06F 7JGbyiJdmRT7SYVvfY+MwXkeNhphLgIlFPQhUJPI3Rvk5QQYmEEp8TBpXN5SjUMYwG/O cWC/GXe3xswk16ByLVv7afNvX8X6uPIORdOXE2ICSMZeT/jTKl1OoawSErL/xmiOdmok lUZs1VEal+wSC/fXe9ZQoBVyasILYUIV0TPWzm7UICZ6g0aoAGfoQZ0IDQHYrHrzRxi+ h/LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=v+lkaRP3G3DZM+ssfC8UAWzAhPFHDzRKVms/SD2Iq4U=; b=VDErBEeGItw6/Qg5xtR3/m9Ok02/6MzPr32bFb+zOtuh4e7f1whQZeo3X+erkaT596 3WLZlaqaS8DGH4fmnPvkd+zkoVzVlQflKm/VXVvr2HySXX4MVIf74leV/5FILTBQqy/y v7rVVRcjWxmWbhy5j6WoULFVzk4oebsSi/AHOTu4FCVAaqvSjXbnw+fDnYiyrRAkxCxm s/RCUoaphEY01sxoln0Fmr3iFoV6XNg6bUyBp+uG+dHfSIrHYrEQrko6LSW3/UkE2yE7 li/jPewaC8s4uPWDjfOzce5TyE31Ml6ukQnwE7QdWB/CCnweQf5wH4SwjK5qnzH+WQ1x uBNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EzYSNQ5V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si5410040pfc.54.2019.06.11.18.29.24; Tue, 11 Jun 2019 18:29:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EzYSNQ5V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436529AbfFKVJL (ORCPT + 99 others); Tue, 11 Jun 2019 17:09:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406960AbfFKVJK (ORCPT ); Tue, 11 Jun 2019 17:09:10 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 542412080A; Tue, 11 Jun 2019 21:09:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560287348; bh=qmpEoNXO99XPF9xd/5iv2nDwyZYxG+9HqzTYNPT4KTw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EzYSNQ5VopjCkhJxjwzVG+3NUfKcn1X9cU/Ns4PV5yZIsnow5MRHYB73/Tl3T81K/ SbRRApw7C7MWKpiNZqE5wCHVmQlPPOHtSxjsrM3RebqPsIl/mcOR/W6a0jpkC0UwOz rSPkBbLzTQO7F5VSs5bcQHmoWK/bst5kRMcBgC7c= Date: Tue, 11 Jun 2019 14:09:07 -0700 From: Andrew Morton To: Andreas Dilger 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 Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Message-Id: <20190611140907.899bebb12a3d731da24a9ad1@linux-foundation.org> In-Reply-To: <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> <6DCAE4F8-3BEC-45F2-A733-F4D15850B7F3@dilger.ca> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?