>> >
>> > I think we should do this unconditionally. The cost of ping-ponging the shared cache line containing reader_counter will increase with large smp counts. On the other hand, zap_page is very rare, so it can be a little slower. Also, less code paths = easier to understand.
>> >
>>
>> On soft mmu, zap_page is very frequently, it can cause performance regression in my test.
>
> Any idea what the cause of the regression is? It seems to me that simply deferring freeing shouldn't have a large impact.
>
I guess it is because the page is freed too frequently, i have done the test, it shows
about 3219 pages is freed per second
Kernbench performance comparing:
the origin way: 3m27.723
free all shadow page in rcu context: 3m30.519