# Re: \[PATCH v4 01/11\] mm: add Kernel Electric-Fence infrastructure

- From: Marco Elver \<elver@google.com\>
- Date: 2020-10-02 21:28:26 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2020/10/6129258
- Thread: https://ratatoskr.run/linux-doc/2020/09/6124388/t.md

```text
On Fri, 2 Oct 2020 at 21:32, Jann Horn [ref] wrote:

> > That's another check; we don't want to make this more expensive.
>
> Ah, right, I missed that this is the one piece of KFENCE that is
> actually really hot code until Dmitry pointed that out.
>
> But actually, can't you reduce how hot this is for SLUB by moving
> is_kfence_address() down into the freeing slowpath? At the moment you
> use it in slab_free_freelist_hook(), which is in the super-hot
> fastpath, but you should be able to at least move it down into
> __slab_free()...
>
> Actually, you already have hooked into __slab_free(), so can't you
> just get rid of the check in the slab_free_freelist_hook()?

I missed this bit: the loop that follows wants the free pointer, so I
currently see how this might work. :-/

We'll look at your other email re optimizing is_kfence_address() next
week; and thank you for the detailed comments thus far!

Thanks,
-- Marco

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
