On 08/30, Linus Torvalds wrote:
>
> Side note: that code had better not be performance-critical, because
> "probe_kernel_address()" is actually really really slow.

Yes, please see

        [PATCH 2/3] introduce probe_slab_address()
        https://lore.kernel.org/lkml/[email protected]/

I sent 5 years ago ;) Do you think

        /*
         * Same as probe_kernel_address(), but @addr must be the valid pointer
         * to a slab object, potentially freed/reused/unmapped.
         */
        #ifdef CONFIG_DEBUG_PAGEALLOC
        #define probe_slab_address(addr, retval)        \
                probe_kernel_address(addr, retval)
        #else
        #define probe_slab_address(addr, retval)        \
                ({                                                      \
                        (retval) = *(typeof(retval) *)(addr);           \
                        0;                                              \
                })
        #endif

can work?

Oleg.

Reply via email to