Re: [GIT PULL] Kmap conversions for 5.12

From: Linus Torvalds
Date: Tue Feb 23 2021 - 12:15:51 EST


On Tue, Feb 23, 2021 at 7:03 AM David Sterba <dsterba@xxxxxxxx> wrote:
> Ira Weiny (8):
> iov_iter: Remove memzero_page() in favor of zero_user()

Ugh. I absolutely _detest_ this patch.

"zero_user()" is a completely horrendous function, and not at all the
same as memzero_page().

Just look at it.

Yes, it's mis-used in a lot of places that really always wanted
"memzero_page()", but this conversion is going exactly the wrong way
around.

Existing users of that zero_user() should have been converted to
memzero_page(), rather than doing it this way.

The "user" naming should have given it away. It's a very very magical
interface for user-mapped pages that have additional odd issues (ie
look at the dcache flushing etc).

I'll think some more about this pull request, but honestly, this one
broken is pretty much enough for me to say "No way in hell", because
it shows a complete disregard for sanity.

The last commit in the series:

> btrfs: convert to zero_user()

is also very mixed up about whether it actually wants the dcache
flushing or not (and thus zero_user() or memzero_page()).

Honestly, I suspect all the dcache flushing is totally pointless,
because any architecture with virtual caches that does kmap needs to
flush at kunmap anyway, afaik. Some of it is probably just voodoo
programming and copying a pattern.

But in any case, zero_user() is not the same thing as memzero_page(),
and even if they *were* the same thing, zero_user() is objectively the
horribly much worse name.

Linus