[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnKwGnxZnnDW-miaUO+M5AN_Np1A0fmj18Mz1AV2aQPzg@mail.gmail.com>
Date: Fri, 27 Oct 2023 08:28:08 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Kent Overstreet <kent.overstreet@...ux.dev>,
Thomas Gleixner <tglx@...utronix.de>,
Suren Baghdasaryan <surenb@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
Vlastimil Babka <vbabka@...e.cz>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Mel Gorman <mgorman@...e.de>,
Davidlohr Bueso <dave@...olabs.net>,
Matthew Wilcox <willy@...radead.org>,
"Liam R. Howlett" <liam.howlett@...cle.com>,
Jonathan Corbet <corbet@....net>, void@...ifault.com,
Peter Zijlstra <peterz@...radead.org>, juri.lelli@...hat.com,
ldufour@...ux.ibm.com, Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
peterx@...hat.com, David Hildenbrand <david@...hat.com>,
Jens Axboe <axboe@...nel.dk>,
Luis Chamberlain <mcgrof@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, dennis@...nel.org,
Tejun Heo <tj@...nel.org>, Muchun Song <muchun.song@...ux.dev>,
Mike Rapoport <rppt@...nel.org>,
"Paul E. McKenney" <paulmck@...nel.org>, pasha.tatashin@...een.com,
yosryahmed@...gle.com, Yu Zhao <yuzhao@...gle.com>,
David Howells <dhowells@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>,
Kees Cook <keescook@...omium.org>, vvvvvv@...gle.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Eric Biggers <ebiggers@...gle.com>, ytcoode@...il.com,
Vincent Guittot <vincent.guittot@...aro.org>,
dietmar.eggemann@....com, Steven Rostedt <rostedt@...dmis.org>,
bsegall@...gle.com, bristot@...hat.com, vschneid@...hat.com,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Hyeonggon Yoo <42.hyeyoo@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Marco Elver <elver@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Muchun Song <songmuchun@...edance.com>,
Jason Baron <jbaron@...mai.com>,
David Rientjes <rientjes@...gle.com>, minchan@...gle.com,
kaleshsingh@...gle.com, kernel-team@...roid.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev, Linux-Arch <linux-arch@...r.kernel.org>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-modules@...r.kernel.org, kasan-dev@...glegroups.com,
cgroups@...r.kernel.org
Subject: Re: [PATCH v2 28/39] timekeeping: Fix a circular include dependency
On Thu, Oct 26, 2023 at 11:35 PM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Fri, Oct 27, 2023, at 01:54, Kent Overstreet wrote:
> > On Fri, Oct 27, 2023 at 01:05:48AM +0200, Thomas Gleixner wrote:
> >> On Thu, Oct 26 2023 at 18:33, Suren Baghdasaryan wrote:
> >> > On Wed, Oct 25, 2023 at 5:33 PM Thomas Gleixner <tglx@...utronix.de> wrote:
> >> >> > This avoids a circular header dependency in an upcoming patch by only
> >> >> > making hrtimer.h depend on percpu-defs.h
> >> >>
> >> >> What's the actual dependency problem?
> >> >
> >> > Sorry for the delay.
> >> > When we instrument per-cpu allocations in [1] we need to include
> >> > sched.h in percpu.h to be able to use alloc_tag_save(). sched.h
> >>
> >> Including sched.h in percpu.h is fundamentally wrong as sched.h is the
> >> initial place of all header recursions.
> >>
> >> There is a reason why a lot of funtionalitiy has been split out of
> >> sched.h into seperate headers over time in order to avoid that.
> >
> > Yeah, it's definitely unfortunate. The issue here is that
> > alloc_tag_save() needs task_struct - we have to pull that in for
> > alloc_tag_save() to be inline, which we really want.
> >
> > What if we moved task_struct to its own dedicated header? That might be
> > good to do anyways...
>
> Yes, I agree that is the best way to handle it. I've prototyped
> a more thorough header cleanup with good results (much improved
> build speed) in the past, and most of the work to get there is
> to seperate out structures like task_struct, mm_struct, net_device,
> etc into headers that only depend on the embedded structure
> definitions without needing all the inline functions associated
> with them.
This is something I'll add to our automation todos which I plan to
talk about at plumbers; I feel like it should be possible to write a
script that given a header and identifier can split whatever
declaration out into a new header, update the old header, then add the
necessary includes for the newly created header to each dependent
(optional).
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists