Re: [mm] be5d0a74c6: will-it-scale.per_thread_ops -9.1% regression

From: Johannes Weiner
Date: Mon Nov 16 2020 - 11:22:10 EST


On Sun, Nov 15, 2020 at 05:55:44PM +0800, kernel test robot wrote:
>
> Greeting,
>
> FYI, we noticed a -9.1% regression of will-it-scale.per_thread_ops due to commit:
>
>
> commit: be5d0a74c62d8da43f9526a5b08cdd18e2bbc37a ("mm: memcontrol: switch to native NR_ANON_MAPPED counter")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>
>
> in testcase: will-it-scale
> on test machine: 192 threads Intel(R) Xeon(R) Platinum 9242 CPU @ 2.30GHz with 192G memory
> with following parameters:
>
> nr_task: 50%
> mode: thread
> test: page_fault2
> cpufreq_governor: performance
> ucode: 0x5002f01

I suspect it's the lock_page_memcg() in page_remove_rmap(). We already
needed it for shared mappings, and this patch added it to private path
as well, which this test exercises.

The slowpath for this lock is extremely cold - most of the time it's
just an rcu_read_lock(). But we're still doing the function call.

Could you try if this patch helps, please?