On Mon, 4 Aug 2025 16:55:09 -0700 Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > On Mon, 4 Aug 2025 at 15:22, Alex Williamson <alex.williamson@xxxxxxxxxx> wrote: > > > > Li Zhe (6): > > mm: introduce num_pages_contiguous() > > WHY? > > There is exactly *ONE* user, why the heck do we introduce this > completely pointless "helper" function, and put it in a core header > file like it was worth it? There was discussion here[1] where David Hildenbrand and Jason Gunthorpe suggested this should be in common code and I believe there was some intent that this would get reused. I took this as endorsement from mm folks. This can certainly be pulled back into subsystem code. > And it's not like that code is some kind of work of art that we want > to expose everybody to *anyway*. It's written in a particularly stupid > way that means that it's *way* more expensive than it needs to be. > > And then it's made "inline" despite the code generation being > horrible, which makes it all entirely pointless. > > Yes, I'm grumpy. This pull request came in late, I'm already > traveling, and then I look at it and it just makes me *angry* at how > bad that code is, and how annoying it is. Sorry, I usually try to get in later during the first week to let the dust settle a bit from the bigger subsystems, I guess I'm running a little behind this cycle. We'll get it fixed and I'll resend. Thanks, Alex > My builds are already slower than usual because they happen on my > laptop while traveling, I do *not* need to see this kind of absolutely > disgusting code that does stupid things that make the build even > slower. > > So I refuse to pull this kind of crap. > > If you insist on making my build slower and exposing these kinds of > helper functions, they had better be *good* helper functions. > > Hint: absolutely nobody cares about "the pages crossed a sparsemem > border. If your driver cares about the number of contiguous pages, it > might as well say "yeah, they are contiguous, but they are in > different sparsemem chunks, so we'll break here too". > > And at that point all you care about is 'struct page' being > contiguous, instead of doing that disgusting 'nth_page'. > > And then - since there is only *one* single user - you don't put it in > the most central header file that EVERYBODY ELSE cares about. > > And you absolutely don't do it if it generates garbage code for no good reason! > > Linus > [1]https://lore.kernel.org/all/20250703111216.GG904431@xxxxxxxx/