From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH] cgroup: reorder flexible array members of struct cgroup_root Date: Sat, 21 Oct 2017 08:32:53 -0700 Message-ID: <20171021153253.GG1302522@devbig577.frc2.facebook.com> References: <20171017063322.11455-1-nick.desaulniers@gmail.com> <20171018133010.GD1302522@devbig577.frc2.facebook.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BfFfPt8KuhOdKW1s4OU/URnjGDCe2CzbaF/zjhwjWzo=; b=ZjGSWhTEXfKBIMXdO1TQu2yGLN8seydnSqxVfgXdWgOpW3GQq6JlF3aNEsXtMLUKKC 0AuCg6FDzqeVrKM/5PnaxvTh1cOgvYXyogR9BQzTWH+Y4UMDHRjRtDxMFoBVE6UigCdq iO3+AA6UJMcverOEbXdrZPDxCyEecyTS2AmQy+SblOqtFtrrnDmB8NXXwBDOBd/qsPSz 0lhp2Lfh5LTssF+AVPNZJ8OV93+76m6EhhYHTQooT8uYFu3GcC3Cw+BrXLvbBVXgServ XTaBSHiFzGjjE9TAQDc6O2jtLiNFpM3y8ofspWlTUlJuIj+br2B7ZXrRD0vVfkXtmT2I p++w== Content-Disposition: inline In-Reply-To: Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nick Desaulniers Cc: Li Zefan , Johannes Weiner , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux Kernel Mailing List , Matthias Kaehlcke , Michael Davidson , Greg Hackmann , android-llvm-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org Hello, Nick. On Fri, Oct 20, 2017 at 12:15:55AM -0700, Nick Desaulniers wrote: > > This is silly tho. We know the the root group embedded there won't > > have any ancestor_ids. > > Sure, but struct cgroup_root is still declared as having a struct > cgroup not declared as the final member. Why is that a problem tho? We know that it doesn't have any flexible array member so there's no storage allocated to it. > > Also, in general, nothing prevents us from > > doing something like the following. > > > > struct outer_struct { > > blah blah; > > struct inner_struct_with_flexible_array_member inner; > > unsigned long storage_for_flexible_array[NR_ENTRIES]; > > blah blah; > > }; > > At that point, then why have the struct with flexible array member in > the first place? Because there are different ways to use the struct? > >> or specific location of the member cgrp within struct cgroup_root AFAICT. > > I think we should just silence the bogus warning. > > Is the order of the members actually important? Otherwise it seems > that we're taking advantage of a GNU C extension for no real reason, > which is what I'm trying to avoid. Please reconsider. Here, not necessarily but I don't want to move it for a bogus reason. Why would we disallow embedding structs with flexible members in the middle when it can be done and is useful? If we want to discuss whether we want to avoid such usages in the kernel (but why?), sure, let's have that discussion but we can't decide that on "clang warns on it by default". Thanks. -- tejun