# Re: \[RFC PATCH v3 12/24\] x86/mm: Modify ptep\_set\_wrprotect and pmdp\_set\_wrprotect for \_PAGE\_DIRTY\_SW

- From: Dave Hansen \<dave.hansen@linux.intel.com\>
- Date: 2018-08-31 15:58:43 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2018/08/5368775
- Thread: https://ratatoskr.run/linux-doc/2018/08/5367691/t.md

```text
On 08/31/2018 08:48 AM, Yu-cheng Yu wrote:
> To trigger a race in ptep_set_wrprotect(), we need to fork from one of
> three pthread siblings.
> 
> Or do we measure only how much this affects fork?
> If there is no racing, the effect should be minimal.

We don't need a race.

I think the cmpxchg will be slower, even without a race, than the code
that was there before.  The cmpxchg is a simple, straightforward
solution, but we're putting it in place of a plain memory write, which
is suboptimal.

But, before I nitpick the performance, I wanted to see if we could even
detect a delta.
```
