# Re: \[PATCH RFC V3 5/9\] x86/pks: Add PKS kernel API

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2020-10-16 11:08:08 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2020/10/190761
- Thread: https://ratatoskr.run/linux-doc/2020/10/190343/t.md

```text
On Fri, Oct 09, 2020 at 12:42:54PM -0700, ira.weiny@intel.com wrote:
> +static inline void pks_update_protection(int pkey, unsigned long protection)
> +{
> +	current->thread.saved_pkrs = update_pkey_val(current->thread.saved_pkrs,
> +						     pkey, protection);
> +	preempt_disable();
> +	write_pkrs(current->thread.saved_pkrs);
> +	preempt_enable();
> +}

write_pkrs() already disables preemption itself. Wrapping it in yet
another layer is useless.
```
