Re: [PATCH] fs: Optimize unixbench's file copy test

From: Matthew Wilcox
Date: Fri Jun 30 2023 - 17:45:07 EST


On Fri, Jun 30, 2023 at 05:28:23PM +0800, zenghongling wrote:
> The iomap_set_range_uptodate function checks if the file is a private
> mapping,and if it is, it needs to do something about it.UnixBench's
> file copy tests are mostly share mapping, such a check would reduce
> file copy scores, so we added the unlikely macro for optimization.
> and the score of file copy can be improved after branch optimization.
>
> - if (page_has_private(page))
> + if (unlikely(page_has_private(page)))

This changelog shows a complete misunderstanding of the code you're
changing. page_has_private() has nothing to do with whether the file
is "a private mapping", whatever that means. The test is whether the
filesystem has added private data to the page.

As Darrick said, this code has been completely rewritten in a current
kernel. You should test with something recent.