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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5CC5C433F5 for ; Fri, 19 Nov 2021 15:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B23A261502 for ; Fri, 19 Nov 2021 15:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235534AbhKSPiQ (ORCPT ); Fri, 19 Nov 2021 10:38:16 -0500 Received: from mga03.intel.com ([134.134.136.65]:18351 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235441AbhKSPiM (ORCPT ); Fri, 19 Nov 2021 10:38:12 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="234379749" X-IronPort-AV: E=Sophos;i="5.87,248,1631602800"; d="scan'208";a="234379749" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 07:35:10 -0800 X-IronPort-AV: E=Sophos;i="5.87,248,1631602800"; d="scan'208";a="506474100" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 07:35:01 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mo5uf-008a3l-IP; Fri, 19 Nov 2021 17:34:53 +0200 Date: Fri, 19 Nov 2021 17:34:53 +0200 From: Andy Shevchenko To: "Alejandro Colomar (man-pages)" Cc: Arnd Bergmann , LKML , Ajit Khaparde , Andrew Morton , Bjorn Andersson , Borislav Petkov , Corey Minyard , Chris Mason , Christian Brauner , David Sterba , Jani Nikula , Jason Wang , Jitendra Bhivare , John Hubbard , "John S . Gruber" , Jonathan Cameron , Joonas Lahtinen , Josef Bacik , Kees Cook , Ketan Mukadam , Len Brown , "Michael S. Tsirkin" , Miguel Ojeda , Mike Rapoport , Nick Desaulniers , "Rafael J. Wysocki" , Rasmus Villemoes , Rodrigo Vivi , Russell King , Somnath Kotur , Sriharsha Basavapatna , Subbu Seetharaman , intel-gfx@lists.freedesktop.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-btrfs@vger.kernel.org, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code Message-ID: References: <20211119113644.1600-1-alx.manpages@gmail.com> <434296d3-8fe1-f1d2-ee9d-ea25d6c4e43e@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <434296d3-8fe1-f1d2-ee9d-ea25d6c4e43e@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 19, 2021 at 04:06:27PM +0100, Alejandro Colomar (man-pages) wrote: > Hi Arnd, > > On 11/19/21 15:47, Arnd Bergmann wrote: > > On Fri, Nov 19, 2021 at 12:36 PM Alejandro Colomar > > wrote: > >> > >> Alejandro Colomar (17): > >> linux/container_of.h: Add memberof(T, m) > >> Use memberof(T, m) instead of explicit NULL dereference > >> Replace some uses of memberof() by its wrappers > >> linux/memberof.h: Move memberof() to separate header > >> linux/typeof_member.h: Move typeof_member() to a separate header > >> Simplify sizeof(typeof_member()) to sizeof_field() > >> linux/NULL.h: Move NULL to a separate header > >> linux/offsetof.h: Move offsetof(T, m) to a separate header > >> linux/offsetof.h: Implement offsetof() in terms of memberof() > >> linux/container_of.h: Implement container_of_safe() in terms of > >> container_of() > >> linux/container_of.h: Cosmetic > >> linux/container_of.h: Remove unnecessary cast to (void *) > > > > My feeling is that this takes the separation too far: by having this many header > > files that end up being included from practically every single .c file > > in the kernel, > > I think you end up making compile speed worse overall. > > > > If your goal is to avoid having to recompile as much of the kernel > > after touching > > a header, I think a better approach is to help untangle the dependencies, e.g. > > by splitting out type definitions from headers with inline functions (most > > indirect header dependencies are on type definitions) and by focusing on > > linux/fs.h, linux/sched.h, linux/mm.h and how they interact with the rest of the > > headers. At the moment, these are included in most .c files and they in turn > > include a ton of other headers. > > Yes, I would like to untangle the dependencies. > > The main reason I started doing this splitting > is because I wouldn't be able to include > in some headers, > because it pulled too much stuff that broke unrelated things. > > So that's why I started from there. > > I for example would like to get NULL in memberof() > without puling anything else, > so makes sense for that. I don't believe that the code that uses NULL won't include types.h. -- With Best Regards, Andy Shevchenko