linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Max Kellermann <max.kellermann@ionos.com>
To: David Hildenbrand <david@redhat.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, willy@infradead.org,
	sfr@canb.auug.org.au
Subject: Re: [PATCH v4 00/15] Fast kernel headers: split linux/mm.h
Date: Tue, 12 Mar 2024 19:11:16 +0100	[thread overview]
Message-ID: <CAKPOu+_EwyQEEVV9ULEkncp3727eLGvqD5aswpkG5CtaZ=oJBQ@mail.gmail.com> (raw)
In-Reply-To: <37ed1ddd-f1d0-4582-b6c5-2f4091dc8335@redhat.com>

On Tue, Mar 12, 2024 at 5:33 PM David Hildenbrand <david@redhat.com> wrote:
> Just curious: why? Usually build time, do you have some numbers?

(This has been discussed so often and I thought having smaller header
dependencies was already established as general consensus among kernel
devs, and everybody agreed that mm.h and kernel.h are a big mess that
needs cleanup.)

Why: Correctness, less namespace pollution, and the least important
aspect is reduced build times. However, the gains by this patch set
are very small; each optimization gains very little.

Some time ago, I posted a much larger patch set with a few numbers:
https://lore.kernel.org/lkml/20240131145008.1345531-1-max.kellermann@ionos.com/
- the speedup was measurable, but not amazing, because even after that
patch set, everybody still includes everything, and much more cleanup
is needed to make a bigger difference. Once the big knots like
kernel.h and mm.h are broken up, we will have better results. And as I
said: build times are nice, but the lesser advantage.

Anyway, this first patch set was so extremely large that nobody was
able to review it. So this patch contains just the parts that deal
with mm.h; later, when this patch set is merged, I can continue with
other headers. (I already have a branch that splits kernel.h and I'll
submit it eventually, after the mm.h cleanup.)

> I'm not against splitting out stuff. But one function per header is a
> bit excessive IMHO.

One function per header is certainly not my goal and I agree it's
excessive; but folio_next() in its own header made sense, just in this
special case, because it allowed removing the mm.h dependency from
bio.h. Removing this dependency was the goal, and folio_next.h was the
solution for this particular problem.

> Ideally, we'd have some MM guideline that we'll be
> able to follow in the future. So we don't need "personal taste".

Agree. But lacking such a guideline, all I can do is make suggestions
and submit patches for review, trying to follow what seemed to be
consensus in previous cleanups and what had previously been merged.

> For example, if I were to write a folio_prev(), should I put it in
> include/linux/mm/folio_prev.h ? Likely we'd put it into folio_next.h,
> but then the name doesn't make any sense.

True. But since no folio_prev() function exists, the only name that
made sense for this header was folio_next.h. If folio_prev() gets
added, I'd say put it in that header, but rename it to, let's say,
"folio_iterator.h". But right now, with just this one function (and
nothing else like it that could be added here), I decided to suggest
naming it "folio_next.h". If you think "folio_iterator.h" or something
else is better, I'll rename and resubmit; names don't matter so much
to me; the general idea of cleaning up the headers is what's
important.

> The point I am trying to make: if there was a single folio_ops.h, it
> would be clearer where it would go.

Maybe, but IMO this wouldn't be a good place to add folio_next(),
because folio_next() doesn't "operate" on a folio, but on a folio
pointer (or "iterator"). Again, names don't matter to me -
ideas/concepts matter. I'm only explaining why I decided to submit my
patches that way, but I'll change them any way you people want.

Max


  reply	other threads:[~2024-03-12 18:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  9:41 Max Kellermann
2024-03-12  9:41 ` [PATCH v4 01/15] drivers: add missing includes on linux/mm.h (and others) Max Kellermann
2024-03-12  9:41 ` [PATCH v4 02/15] include/drm/drm_gem.h: add poll_table_struct forward declaration Max Kellermann
2024-03-12  9:41 ` [PATCH v4 03/15] include/scsi/scsicam.h: forward-declare struct block_device Max Kellermann
2024-03-12  9:41 ` [PATCH v4 04/15] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 05/15] linux/mm.h: move section functions to mm/page_section.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 06/15] linux/mm.h: move page_address() and others to mm/page_address.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 07/15] linux/mm.h: move folio_size(), ... to mm/folio_size.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 08/15] linux/mm.h: move folio_next() to mm/folio_next.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 09/15] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 10/15] linux/mm.h: move usage count functions to mm/folio_usage.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 11/15] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 13/15] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 14/15] linux/mm.h: move high_memory to mm/high_memory.h Max Kellermann
2024-03-12  9:41 ` [PATCH v4 15/15] include: reduce dependencies on linux/mm.h Max Kellermann
2024-03-12 16:10 ` [PATCH v4 00/15] Fast kernel headers: split linux/mm.h David Hildenbrand
2024-03-12 16:27   ` Max Kellermann
2024-03-12 16:32     ` David Hildenbrand
2024-03-12 18:11       ` Max Kellermann [this message]
2024-03-12 19:26         ` David Hildenbrand
2024-03-12 19:50           ` Max Kellermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKPOu+_EwyQEEVV9ULEkncp3727eLGvqD5aswpkG5CtaZ=oJBQ@mail.gmail.com' \
    --to=max.kellermann@ionos.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sfr@canb.auug.org.au \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox