Re: [PATCH v4 3/9] mm: pagewalk: Don't split transhuge pmds when a pmd_entry is present

From: Linus Torvalds
Date: Wed Oct 09 2019 - 12:21:30 EST

On Wed, Oct 9, 2019 at 8:27 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
> Do we have any current user that expect split_huge_pmd() in this scenario.

No. There are no current users of the pmd callback and the pte
callback at all, that I could find.

But it looks like the new drm use does want a "I can't handle the
hugepage, please split it and I'll fo the ptes instead".

> That's hacky.
> Maybe just use an error code for this? -EAGAIN?

I actually like the PAGE_WALK_FALLBACK thing as more documentation
than "it's an error, but not one you return", although I do detest the
particular value chosen, which is just a nasty bitpattern.

Maybe it could use an error value, just one that makes no sense, and
is hidden by the PAGE_WALK_FALLBACK define, ie something like


or something like that.

And I suspect the conditional would be cleaner if it was written something like

if (!err)
err = 0;
if (pmd_trans_unstable(pmd))
goto again;
.. do the split ..

and skip the WARN_ON() and the odd "non-zero but smaller than MAX test"